def setup_class(cls): """Setup section that runs before each test suite""" cls.hive_client, cls.client = [None, None] # Create a Hive Metastore Client (used for executing some test SETUP steps metastore_host, metastore_port = pytest.config.option.metastore_server.split( ':') trans_type = 'buffered' if pytest.config.option.use_kerberos: trans_type = 'kerberos' cls.hive_transport = create_transport( host=metastore_host, port=metastore_port, service=pytest.config.option.hive_service_name, transport_type=trans_type) protocol = TBinaryProtocol.TBinaryProtocol(cls.hive_transport) cls.hive_client = ThriftHiveMetastore.Client(protocol) cls.hive_transport.open() # Create a connection to Impala. cls.client = cls.create_impala_client(IMPALAD) # Default query options are populated on demand. cls.default_query_options = {} cls.impalad_test_service = cls.create_impala_service() cls.hdfs_client = cls.create_hdfs_client() cls.filesystem_client = cls.hdfs_client if IS_S3: cls.filesystem_client = S3Client(S3_BUCKET_NAME) elif IS_ADLS: cls.filesystem_client = ADLSClient(ADLS_STORE_NAME)
class ImpalaTestSuite(BaseTestSuite): @classmethod def add_test_dimensions(cls): """ A hook for adding additional dimensions. By default load the table_info and exec_option dimensions, but if a test wants to add more dimensions or different dimensions they can override this function. """ super(ImpalaTestSuite, cls).add_test_dimensions() cls.ImpalaTestMatrix.add_dimension( cls.create_table_info_dimension(cls.exploration_strategy())) cls.ImpalaTestMatrix.add_dimension( cls.__create_exec_option_dimension()) # Execute tests through Beeswax by default. Individual tests that have been converted # to work with the HS2 client can add HS2 in addition to or instead of beeswax. cls.ImpalaTestMatrix.add_dimension( ImpalaTestDimension('protocol', 'beeswax')) @classmethod def setup_class(cls): """Setup section that runs before each test suite""" cls.hive_client, cls.client, cls.hs2_client = [None, None, None] # Create a Hive Metastore Client (used for executing some test SETUP steps metastore_host, metastore_port = pytest.config.option.metastore_server.split( ':') trans_type = 'buffered' if pytest.config.option.use_kerberos: trans_type = 'kerberos' cls.hive_transport = create_transport( host=metastore_host, port=metastore_port, service=pytest.config.option.hive_service_name, transport_type=trans_type) protocol = TBinaryProtocol.TBinaryProtocol(cls.hive_transport) cls.hive_client = ThriftHiveMetastore.Client(protocol) cls.hive_transport.open() # Create a connection to Impala, self.client is Beeswax so that existing tests that # assume beeswax do not need modification (yet). cls.client = cls.create_impala_client(protocol='beeswax') try: cls.hs2_client = cls.create_impala_client(protocol='hs2') except Exception, e: # HS2 connection can fail for benign reasons, e.g. running with unsupported auth. LOG.info("HS2 connection setup failed, continuing...: {0}", e) # Default query options are populated on demand. cls.default_query_options = {} cls.impalad_test_service = cls.create_impala_service() cls.hdfs_client = cls.create_hdfs_client() cls.filesystem_client = cls.hdfs_client if IS_S3: cls.filesystem_client = S3Client(S3_BUCKET_NAME) elif IS_ABFS: cls.filesystem_client = ABFSClient() elif IS_ADLS: cls.filesystem_client = ADLSClient(ADLS_STORE_NAME) # Override the shell history path so that commands run by any tests # don't write any history into the developer's file. os.environ['IMPALA_HISTFILE'] = '/dev/null'