This is an automated email from the ASF dual-hosted git repository. richardantal pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix-queryserver.git
The following commit(s) were added to refs/heads/master by this push: new c2f8db6 PHOENIX-6781 Fix flaky tests and define auch mech for SPNEGO explicitly (#105) c2f8db6 is described below commit c2f8db69ac8377accd9e686df44e5f5e14ed3022 Author: richardantal <antal97rich...@gmail.com> AuthorDate: Thu Sep 1 15:41:11 2022 +0200 PHOENIX-6781 Fix flaky tests and define auch mech for SPNEGO explicitly (#105) --- .../phoenix/end2end/SecureQueryServerPhoenixDBIT.java | 1 + python-phoenixdb/phoenixdb/__init__.py | 16 ++++++++++------ python-phoenixdb/phoenixdb/tests/test_db.py | 1 + python-phoenixdb/phoenixdb/tests/test_sqlalchemy.py | 2 ++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/phoenix-queryserver-it/src/it/java/org/apache/phoenix/end2end/SecureQueryServerPhoenixDBIT.java b/phoenix-queryserver-it/src/it/java/org/apache/phoenix/end2end/SecureQueryServerPhoenixDBIT.java index 162285e..8ba86be 100644 --- a/phoenix-queryserver-it/src/it/java/org/apache/phoenix/end2end/SecureQueryServerPhoenixDBIT.java +++ b/phoenix-queryserver-it/src/it/java/org/apache/phoenix/end2end/SecureQueryServerPhoenixDBIT.java @@ -204,6 +204,7 @@ public class SecureQueryServerPhoenixDBIT { checkForCommandOnPath("kinit"); final Configuration conf = UTIL.getConfiguration(); + conf.set("hbase.regionserver.wal.codec", "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec"); // Ensure the dirs we need are created/empty ensureIsEmptyDirectory(TEMP_DIR); ensureIsEmptyDirectory(KEYTAB_DIR); diff --git a/python-phoenixdb/phoenixdb/__init__.py b/python-phoenixdb/phoenixdb/__init__.py index 93f47eb..44b4136 100644 --- a/python-phoenixdb/phoenixdb/__init__.py +++ b/python-phoenixdb/phoenixdb/__init__.py @@ -123,6 +123,14 @@ def connect(url, max_retries=None, auth=None, authentication=None, avatica_user= return Connection(client, **kwargs) +def _get_SPNEGOAuth(): + try: + spnego = gssapi.mechs.Mechanism.from_sasl_name("SPNEGO") + except AttributeError: + spnego = gssapi.OID.from_int_seq("1.3.6.1.5.5.2") + return HTTPSPNEGOAuth(opportunistic_auth=True, mech=spnego) + + def _process_args( url, auth=None, authentication=None, avatica_user=None, avatica_password=None, truststore=None, verify=None, do_as=None, user=None, password=None): @@ -176,14 +184,10 @@ def _process_args( if auth == "SPNEGO": # Special case for backwards compatibility - auth = HTTPSPNEGOAuth(opportunistic_auth=True) + auth = _get_SPNEGOAuth() elif auth is None and authentication is not None: if authentication == "SPNEGO": - try: - spnego = gssapi.mechs.Mechanism.from_sasl_name("SPNEGO") - except AttributeError: - spnego = gssapi.OID.from_int_seq("1.3.6.1.5.5.2") - auth = HTTPSPNEGOAuth(opportunistic_auth=True, mech=spnego) + auth = _get_SPNEGOAuth() elif authentication == "BASIC" and avatica_user is not None and avatica_password is not None: auth = HTTPBasicAuth(avatica_user, avatica_password) elif authentication == "DIGEST" and avatica_user is not None and avatica_password is not None: diff --git a/python-phoenixdb/phoenixdb/tests/test_db.py b/python-phoenixdb/phoenixdb/tests/test_db.py index 6b94ba8..82a1a65 100644 --- a/python-phoenixdb/phoenixdb/tests/test_db.py +++ b/python-phoenixdb/phoenixdb/tests/test_db.py @@ -125,6 +125,7 @@ class PhoenixDatabaseTest(DatabaseTestCase): def test_meta(self): with self.conn.cursor() as cursor: try: + cursor.execute('drop table if exists USERS') cursor.execute('drop table if exists DEFAULT_TABLE') cursor.execute('drop table if exists A_SCHEMA.A_TABLE') cursor.execute('drop table if exists B_SCHMEA.B_TABLE') diff --git a/python-phoenixdb/phoenixdb/tests/test_sqlalchemy.py b/python-phoenixdb/phoenixdb/tests/test_sqlalchemy.py index 82ebcc7..8fc9c9b 100644 --- a/python-phoenixdb/phoenixdb/tests/test_sqlalchemy.py +++ b/python-phoenixdb/phoenixdb/tests/test_sqlalchemy.py @@ -59,11 +59,13 @@ class SQLAlchemyTest(unittest.TestCase): try: inspector = db.inspect(engine) + connection.execute('drop table if exists USERS') connection.execute('drop table if exists ALCHEMY_TEST') connection.execute('drop table if exists A.ALCHEMY_TEST_A') connection.execute('drop table if exists B.ALCHEMY_TEST_B') self.assertEqual(inspector.get_schema_names(), ['', 'SYSTEM']) + self.assertEqual(inspector.get_table_names(), []) connection.execute(text('create table ALCHEMY_TEST (ID integer primary key)')) connection.execute(text('create table A.ALCHEMY_TEST_A (ID_A integer primary key)'))