def setUp(self): self.handles = list() self.list_tables_requests = list() self.num_handles = 1 if is_prod_pod() or is_onprem() else 2 for handle in range(self.num_handles): tenant = tenant_id + ('' if handle == 0 else str(handle)) self.handles.append(get_handle(tenant)) self.list_tables_requests.append( ListTablesRequest().set_timeout(timeout)) self.list_tables_request = ListTablesRequest().set_timeout(timeout)
def tearDownClass(cls): for handle in range(len(cls.handles)): try: ltr = ListTablesRequest() result = cls.handles[handle].list_tables(ltr) for table in result.get_tables(): if table.startswith(table_prefix): drop_request = TableRequest().set_statement( 'DROP TABLE IF EXISTS ' + table) cls.table_request(drop_request, cls.handles[handle]) finally: cls.handles[handle].close() delete_tenant(tenant_id + str(handle)) delete_tier()
def testAccessTokenProviderOldPath(self): account_at = 'account-at' service_at = 'service-at' class TokenHandler(SimpleHTTPRequestHandler): def do_GET(self): rawpath = self.path.split('?')[0] if rawpath == APP_ENDPOINT: self.send_response(codes.ok) self.send_header('Content-Type', 'application/json') self.send_header('Content-Length', str(len(PSM_INFO))) self.end_headers() self.wfile.write(PSM_INFO.encode()) def do_POST(self): rawpath = self.path.split('?')[0] if rawpath == TOKEN_ENDPOINT: content = self.rfile.read( int(self.headers['Content-Length'])) content = unquote(content.decode()) if 'andc' in content: res = str.format(TOKEN_RESULT, service_at) else: res = str.format(TOKEN_RESULT, account_at) self.send_response(codes.ok) self.send_header('Content-Type', 'application/json') self.send_header('Content-Length', str(len(res))) self.end_headers() self.wfile.write(res.encode()) httpd, port = self.__find_port_start_server(TokenHandler) self.base = 'http://localhost:' + str(port) self.token_provider = DefaultAccessTokenProvider( idcs_url=self.base, entitlement_id='123456789', creds_provider=self.creds_provider) # get authorization string for ListTablesRequest result = self.token_provider.get_authorization_string( ListTablesRequest()) self.assertIsNotNone(result) self.assertEqual(result, 'Bearer ' + account_at) # get authorization string for TableRequest result = self.token_provider.get_authorization_string(TableRequest()) self.assertIsNotNone(result) self.assertEqual(result, 'Bearer ' + service_at) self.__stop_server(httpd)
def testRealCloudGetAuthorizationStringAndToken(self): generate_properties_file(idcs_url(), credentials_file) self.token_provider = DefaultAccessTokenProvider( idcs_props_file=properties_file) # get authorization string for ListTablesRequest result = self.token_provider.get_authorization_string( ListTablesRequest()) self.assertIsNotNone(result) # get authorization string for TableRequest result = self.token_provider.get_authorization_string( TableRequest()) self.assertIsNotNone(result) # get account access token result = self.token_provider.get_account_access_token() self.assertIsNotNone(result) # get service access token result = self.token_provider.get_service_access_token() self.assertIsNotNone(result)
def testAccessTokenProviderGetAuthorizationString(self): global GET_INFO, POST_INFO GET_INFO = CLIENT_INFO POST_INFO = None httpd, port = self._find_port_start_server(TokenHandler) self.base = 'http://localhost:' + str(port) self.token_provider = DefaultAccessTokenProvider( idcs_url=self.base, creds_provider=self.creds_provider) # get authorization string for ListTablesRequest result = self.token_provider.get_authorization_string( ListTablesRequest()) self.assertIsNotNone(result) self.assertEqual(result, 'Bearer ' + ACCOUNT_AT) # get authorization string for TableRequest result = self.token_provider.get_authorization_string(TableRequest()) self.assertIsNotNone(result) self.assertEqual(result, 'Bearer ' + SERVICE_AT) self._stop_server(httpd)
def drop_all_tables(cls): ltr = ListTablesRequest() result = cls.handle.list_tables(ltr) for table in result.get_tables(): if table.startswith(table_prefix): cls.drop_table(table)
def main(): handle = None try: # # Create a handle # handle = get_handle(tenant_id) # # List any existing tables for this tenant # print('Listing tables') ltr = ListTablesRequest() lr_result = handle.list_tables(ltr) print('Existing tables: ' + str(lr_result)) # # Create a table # statement = 'Create table if not exists ' + table_name + '(id integer, \ sid integer, name string, primary key(shard(sid), id))' print('Creating table: ' + statement) request = TableRequest().set_statement(statement).set_table_limits( TableLimits(30, 10, 1)) result = handle.table_request(request) # # Table creation can take time, depending on the state of the system. # If if fails after 40s, re-run the program # result.wait_for_state(handle, table_name, State.ACTIVE, 40000, 3000) print('After create table') # # Create an index # statement = ('Create index if not exists ' + index_name + ' on ' + table_name + '(name)') print('Creating index: ' + statement) request = TableRequest().set_statement(statement) result = handle.table_request(request) # # Index creation can take time, depending on the state of the system. # If if fails after 40s, re-run the program # result.wait_for_state(handle, table_name, State.ACTIVE, 40000, 3000) print('After create index') # # Get the table # request = GetTableRequest().set_table_name(table_name) result = handle.get_table(request) print('After get table: ' + str(result)) # # Get the indexes # request = GetIndexesRequest().set_table_name(table_name) result = handle.get_indexes(request) print('The indexes for: ' + table_name) for idx in result.get_indexes(): print('\t' + str(idx)) # # Get the table usage information # request = TableUsageRequest().set_table_name(table_name) result = handle.get_table_usage(request) print('The table usage information for: ' + table_name) for record in result.get_usage_records(): print('\t' + str(record)) # # Drop the table # if drop_table: request = TableRequest().set_statement('drop table if exists ' + table_name) result = handle.table_request(request) # # Table drop can take time, depending on the state of the system. # If this wait fails the table will still probably been dropped # result.wait_for_state(handle, table_name, State.DROPPED, 30000, 2000) print('After drop table') else: print('Not dropping table') print('Example is complete') except Exception as e: print(e) traceback.print_exc() finally: # If the handle isn't closed Python will not exit properly if handle is not None: handle.close()
class TestListTables(unittest.TestCase, TestBase): handles = None @classmethod def setUpClass(cls): add_tier() cls.handles = list() global table_names table_names = list() num_tables = 3 # # In pod env create 1 handle, otherwise create 2 handles for additional # testing # num_handles = 1 if is_prod_pod() or is_onprem() else 2 for handle in range(num_handles): add_tenant(tenant_id + str(handle)) table_names.append(list()) cls.handles.append(get_handle(tenant_id + str(handle))) for table in range(handle + num_tables): tb_name = table_name + str(table) table_names[handle].append(tb_name) # # Add a sleep for a pod to let things happen # if is_pod(): sleep(60) drop_request = TableRequest().set_statement( 'DROP TABLE IF EXISTS ' + tb_name) cls.table_request(drop_request, cls.handles[handle]) create_statement = ('CREATE TABLE ' + tb_name + '(fld_id INTEGER, \ fld_long LONG, fld_float FLOAT, fld_double DOUBLE, fld_bool BOOLEAN, \ fld_str STRING, fld_bin BINARY, fld_time TIMESTAMP(2), fld_num NUMBER, \ fld_json JSON, fld_arr ARRAY(STRING), fld_map MAP(STRING), \ fld_rec RECORD(fld_id LONG, fld_bool BOOLEAN, fld_str STRING), \ PRIMARY KEY(fld_id)) USING TTL 16 HOURS') limits = TableLimits(5000, 5000, 50) create_request = TableRequest().set_statement( create_statement).set_table_limits(limits) cls.table_request(create_request, cls.handles[handle]) @classmethod def tearDownClass(cls): for handle in range(len(cls.handles)): try: ltr = ListTablesRequest() result = cls.handles[handle].list_tables(ltr) for table in result.get_tables(): if table.startswith(table_prefix): drop_request = TableRequest().set_statement( 'DROP TABLE IF EXISTS ' + table) cls.table_request(drop_request, cls.handles[handle]) finally: cls.handles[handle].close() delete_tenant(tenant_id + str(handle)) delete_tier() def setUp(self): self.handles = list() self.num_handles = 1 if is_prod_pod() or is_onprem() else 2 for handle in range(self.num_handles): self.handles.append(get_handle(tenant_id + str(handle))) self.list_tables_request = ListTablesRequest().set_timeout(timeout) def tearDown(self): for handle in self.handles: handle.close() def testListTablesSetIllegalStartIndex(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, 'IllegalStartIndex') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, -1) def testListTablesSetIllegalTimeout(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, 'IllegalTimeout') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, 0) self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, -1) def testListTablesSetIllegalLimit(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_limit, 'IllegalLimit') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, -1) def testListTablesSetIllegalNamespace(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_namespace, {}) def testListTablesGets(self): self.list_tables_request.set_limit(5).set_namespace(namespace) self.assertEqual(self.list_tables_request.get_start_index(), 0) self.assertEqual(self.list_tables_request.get_limit(), 5) self.assertEqual(self.list_tables_request.get_namespace(), namespace) def testListTablesIllegalRequest(self): for handle in range(self.num_handles): self.assertRaises(IllegalArgumentException, self.handles[handle].list_tables, 'IllegalRequest') def testListTablesNormal(self): last_returned_index = [3, 4] self._check_list_tables_result(table_names, last_returned_index) def testListTablesWithStartIndex(self): last_returned_index = [3, 4] # set a start index larger than the number of tables self.list_tables_request.set_start_index(5) self._check_list_tables_result([[], []], last_returned_index) # set start_index = 1 part_table_names = [[ make_table_name('Users1'), make_table_name('Users2') ], [ make_table_name('Users1'), make_table_name('Users2'), make_table_name('Users3') ]] self.list_tables_request.set_start_index(1) self._check_list_tables_result(part_table_names, last_returned_index) def testListTablesWithLimit(self): # set limit = 2 last_returned_index = [2, 2] part_table_names = [[ make_table_name('Users0'), make_table_name('Users1') ], [make_table_name('Users0'), make_table_name('Users1')]] self.list_tables_request.set_limit(2) self._check_list_tables_result(part_table_names, last_returned_index, True) def testListTablesWithNamespace(self): if is_onprem(): # set a namespace that not exist self.list_tables_request.set_namespace(namespace) self._check_list_tables_result([[]], [0], True) def _check_list_tables_result(self, names, last_returned_index, eq=False): for handle in range(self.num_handles): result = self.handles[handle].list_tables(self.list_tables_request) if is_minicloud(): # TODO: Minicloud doesn't handle start index and limit so far, # and the last index returned is always 0. self.assertEqual(result.get_tables(), table_names[handle]) self.assertEqual(result.get_last_returned_index(), 0) elif is_onprem() and not eq: self.assertGreater(set(result.get_tables()), set(names[handle])) self.assertGreater(result.get_last_returned_index(), last_returned_index[handle]) else: self.assertEqual(result.get_tables(), names[handle]) self.assertEqual(result.get_last_returned_index(), last_returned_index[handle])
def main(): handle = None try: # # Create a handle # handle = get_handle(tenant_id) # # List any existing tables for this tenant # print('Listing tables') ltr = ListTablesRequest() lr_result = handle.list_tables(ltr) print('Existing tables: ' + str(lr_result)) # # Create a table # statement = 'Create table if not exists ' + table_name + '(id integer, \ sid integer, name string, primary key(shard(sid), id))' print('Creating table: ' + statement) request = TableRequest().set_statement(statement).set_table_limits( TableLimits(30, 10, 1)) handle.do_table_request(request, 40000, 3000) print('After create table') # # Create an index # statement = ('Create index if not exists ' + index_name + ' on ' + table_name + '(name)') print('Creating index: ' + statement) request = TableRequest().set_statement(statement) handle.do_table_request(request, 40000, 3000) print('After create index') # # Get the table # request = GetTableRequest().set_table_name(table_name) result = handle.get_table(request) print('After get table: ' + str(result)) # # Get the indexes # request = GetIndexesRequest().set_table_name(table_name) result = handle.get_indexes(request) print('The indexes for: ' + table_name) for idx in result.get_indexes(): print('\t' + str(idx)) # # Get the table usage information, on-prem mode not supported # if not using_on_prem: request = TableUsageRequest().set_table_name(table_name) result = handle.get_table_usage(request) print('The table usage information for: ' + table_name) for record in result.get_usage_records(): print('\t' + str(record)) # # Drop the index # request = TableRequest().set_statement( 'drop index ' + index_name + ' on ' + table_name) handle.do_table_request(request, 30000, 2000) print('After drop index') # # Drop the table # if drop_table: request = TableRequest().set_statement( 'drop table if exists ' + table_name) handle.do_table_request(request, 30000, 2000) print('After drop table') else: print('Not dropping table') print('Example is complete') except Exception as e: print(e) traceback.print_exc() finally: # If the handle isn't closed Python will not exit properly if handle is not None: handle.close()
def setUp(self): self.handles = list() self.num_handles = 1 if is_pod() else 2 for handle in range(self.num_handles): self.handles.append(get_handle(tenant_id + str(handle))) self.list_tables_request = ListTablesRequest().set_timeout(timeout)
class TestListTables(unittest.TestCase): @classmethod def setUpClass(cls): add_tier() cls._handles = list() cls._drop_requests = list() global table_names table_names = list() num_tables = 3 # # In pod env create 1 handle, otherwise create 2 handles for additional # testing # cls._num_handles = 1 if is_pod() else 2 for handle in range(cls._num_handles): add_tenant(tenant_id + str(handle)) table_names.append(list()) cls._drop_requests.append(list()) cls._handles.append(get_handle(tenant_id + str(handle))) for table in range(handle + num_tables): table_names[handle].append(table_name + str(table)) for table in range(handle + num_tables): # # Add a sleep for a pod to let things happen # if is_pod(): sleep(60) drop_statement = ('DROP TABLE IF EXISTS ' + table_names[handle][table]) drop_request = TableRequest().set_statement(drop_statement) cls._drop_requests[handle].append(drop_request) cls._result = cls._handles[handle].table_request(drop_request) cls._result.wait_for_state(cls._handles[handle], table_names[handle][table], State.DROPPED, wait_timeout, 1000) create_statement = ('CREATE TABLE ' + table_names[handle][table] + '(\ fld_id INTEGER, fld_long LONG, fld_float FLOAT, fld_double DOUBLE, \ fld_bool BOOLEAN, fld_str STRING, fld_bin BINARY, fld_time TIMESTAMP(2), \ fld_num NUMBER, fld_json JSON, fld_arr ARRAY(STRING), fld_map MAP(STRING), \ fld_rec RECORD(fld_id LONG, fld_bool BOOLEAN, fld_str STRING), \ PRIMARY KEY(fld_id)) USING TTL 16 HOURS') limits = TableLimits(5000, 5000, 50) create_request = TableRequest().set_statement( create_statement).set_table_limits(limits) cls._result = cls._handles[handle].table_request( create_request) cls._result.wait_for_state(cls._handles[handle], table_names[handle][table], State.ACTIVE, wait_timeout, 1000) @classmethod def tearDownClass(cls): for handle in range(cls._num_handles): try: for table in range(len(table_names[handle])): cls._result = cls._handles[handle].table_request( cls._drop_requests[handle][table]) cls._result.wait_for_state(cls._handles[handle], table_names[handle][table], State.DROPPED, wait_timeout, 1000) finally: cls._handles[handle].close() delete_tenant(tenant_id + str(handle)) delete_tier() def setUp(self): self.handles = list() self.num_handles = 1 if is_pod() else 2 for handle in range(self.num_handles): self.handles.append(get_handle(tenant_id + str(handle))) self.list_tables_request = ListTablesRequest().set_timeout(timeout) def tearDown(self): for handle in self.handles: handle.close() def testListTablesSetIllegalStartIndex(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, 'IllegalStartIndex') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, -1) def testListTablesSetIllegalTimeout(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, 'IllegalTimeout') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, 0) self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, -1) def testListTablesSetIllegalLimit(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_limit, 'IllegalLimit') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, -1) def testListTablesGets(self): self.list_tables_request.set_limit(5) self.assertEqual(self.list_tables_request.get_start_index(), 0) self.assertEqual(self.list_tables_request.get_limit(), 5) def testListTablesIllegalRequest(self): for handle in range(self.num_handles): self.assertRaises(IllegalArgumentException, self.handles[handle].list_tables, 'IllegalRequest') def testListTablesNormal(self): last_returned_index = [3, 4] for handle in range(self.num_handles): result = self.handles[handle].list_tables(self.list_tables_request) # TODO: add and use startIndex,numTables. if not not_cloudsim(): self.assertEqual(result.get_tables(), table_names[handle]) self.assertEqual(result.get_last_returned_index(), last_returned_index[handle]) def testListTablesWithStartIndex(self): last_returned_index = [3, 4] # set a start index larger than the number of tables self.list_tables_request.set_start_index(5) for handle in range(self.num_handles): result = self.handles[handle].list_tables(self.list_tables_request) # TODO: add and use startIndex,numTables. if not not_cloudsim(): self.assertEqual(result.get_tables(), []) self.assertEqual(result.get_last_returned_index(), last_returned_index[handle]) # set start_index = 1 part_table_names = [[ make_table_name('Users1'), make_table_name('Users2') ], [ make_table_name('Users1'), make_table_name('Users2'), make_table_name('Users3') ]] self.list_tables_request.set_start_index(1) for handle in range(self.num_handles): result = self.handles[handle].list_tables(self.list_tables_request) # TODO: add and use startIndex,numTables. if not not_cloudsim(): self.assertEqual(result.get_tables(), part_table_names[handle]) self.assertEqual(result.get_last_returned_index(), last_returned_index[handle]) def testListTablesWithLimit(self): # set limit = 2 last_returned_index = 2 part_table_names = [[ make_table_name('Users0'), make_table_name('Users1') ], [make_table_name('Users0'), make_table_name('Users1')]] self.list_tables_request.set_limit(2) for handle in range(self.num_handles): result = self.handles[handle].list_tables(self.list_tables_request) # TODO: add and use startIndex,numTables. if not not_cloudsim(): self.assertEqual(result.get_tables(), part_table_names[handle]) self.assertEqual(result.get_last_returned_index(), last_returned_index)
class TestListTables(unittest.TestCase, TestBase): handles = None @classmethod def setUpClass(cls): add_tier() cls.handles = list() global table_names table_names = list() num_tables = 3 # # In pod env create 1 handle, otherwise create 2 handles for additional # testing # num_handles = 1 if is_prod_pod() or is_onprem() else 2 for handle in range(num_handles): tenant = tenant_id + ('' if handle == 0 else str(handle)) add_tenant(tenant) table_names.append(list()) cls.handles.append(get_handle(tenant)) for table in range(handle + num_tables): tb_name = table_name + str(table) table_names[handle].append(tb_name) # # Add a sleep for a pod to let things happen # if is_pod(): sleep(60) drop_request = TableRequest().set_statement( 'DROP TABLE IF EXISTS ' + tb_name) cls.table_request(drop_request, cls.handles[handle]) create_statement = ('CREATE TABLE ' + tb_name + '(fld_id INTEGER, \ fld_long LONG, fld_float FLOAT, fld_double DOUBLE, fld_bool BOOLEAN, \ fld_str STRING, fld_bin BINARY, fld_time TIMESTAMP(2), fld_num NUMBER, \ fld_json JSON, fld_arr ARRAY(STRING), fld_map MAP(STRING), \ fld_rec RECORD(fld_id LONG, fld_bool BOOLEAN, fld_str STRING), \ PRIMARY KEY(fld_id)) USING TTL 16 HOURS') limits = TableLimits(10, 10, 1) create_request = TableRequest().set_statement( create_statement).set_table_limits(limits) cls.table_request(create_request, cls.handles[handle]) @classmethod def tearDownClass(cls): for handle in range(len(cls.handles)): tenant = tenant_id + ('' if handle == 0 else str(handle)) try: ltr = ListTablesRequest() result = cls.handles[handle].list_tables(ltr) for table in result.get_tables(): if table.startswith(table_prefix): drop_request = TableRequest().set_statement( 'DROP TABLE IF EXISTS ' + table) cls.table_request(drop_request, cls.handles[handle]) finally: cls.handles[handle].close() delete_tenant(tenant) delete_tier() def setUp(self): self.handles = list() self.list_tables_requests = list() self.num_handles = 1 if is_prod_pod() or is_onprem() else 2 for handle in range(self.num_handles): tenant = tenant_id + ('' if handle == 0 else str(handle)) self.handles.append(get_handle(tenant)) self.list_tables_requests.append( ListTablesRequest().set_timeout(timeout)) self.list_tables_request = ListTablesRequest().set_timeout(timeout) def tearDown(self): for handle in self.handles: handle.close() def testListTablesSetIllegalCompartment(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_compartment, {}) self.assertRaises(IllegalArgumentException, self.list_tables_request.set_compartment, '') def testListTablesSetIllegalStartIndex(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, 'IllegalStartIndex') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, -1) def testListTablesSetIllegalTimeout(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, 'IllegalTimeout') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, 0) self.assertRaises(IllegalArgumentException, self.list_tables_request.set_timeout, -1) def testListTablesSetIllegalLimit(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_limit, 'IllegalLimit') self.assertRaises(IllegalArgumentException, self.list_tables_request.set_start_index, -1) def testListTablesSetIllegalNamespace(self): self.assertRaises(IllegalArgumentException, self.list_tables_request.set_namespace, {}) def testListTablesGets(self): self.list_tables_request.set_limit(5).set_namespace(namespace) self.assertIsNone(self.list_tables_request.get_compartment()) self.assertEqual(self.list_tables_request.get_start_index(), 0) self.assertEqual(self.list_tables_request.get_limit(), 5) self.assertEqual(self.list_tables_request.get_namespace(), namespace) def testListTablesIllegalRequest(self): for handle in range(self.num_handles): self.assertRaises(IllegalArgumentException, self.handles[handle].list_tables, 'IllegalRequest') def testListTablesNormal(self): last_returned_index = [3, 4] self._check_list_tables_result(table_names, last_returned_index) def testListTablesWithStartIndex(self): last_returned_index = [3, 4] # set start_index = 1 part_table_names = [[ self._make_table_name('Users1'), self._make_table_name('Users2') ], [ self._make_table_name('Users1'), self._make_table_name('Users2'), self._make_table_name('Users3') ]] for handle in range(self.num_handles): self.list_tables_requests[handle].set_start_index(1) self._check_list_tables_result(part_table_names, last_returned_index) def testListTablesWithLimit(self): # set limit = 2 tables = [[], []] start_index = [0, 0] while True: more = False for handle in range(self.num_handles): self.list_tables_requests[handle].set_start_index( start_index[handle]).set_limit(2) result = self.handles[handle].list_tables( self.list_tables_requests[handle]) tbs = result.get_tables() start_index[handle] = result.get_last_returned_index() self.assertLessEqual(len(tbs), 2) tables[handle].extend(tbs) more = more or len(tbs) != 0 if not more: break for handle in range(self.num_handles): self.assertTrue( set(tables[handle]).issuperset(set(table_names[handle]))) def testListTablesWithNamespace(self): if is_onprem(): # set a namespace that not exist for handle in range(self.num_handles): self.list_tables_requests[handle].set_namespace(namespace) result = self.handles[handle].list_tables( self.list_tables_requests[handle]) self.assertEqual(result.get_tables(), []) self.assertEqual(result.get_last_returned_index(), 0) def _check_list_tables_result(self, names, last_returned_index): for handle in range(self.num_handles): result = self.handles[handle].list_tables( self.list_tables_requests[handle]) self.assertTrue( set(result.get_tables()).issuperset(set(names[handle]))) self.assertGreaterEqual(result.get_last_returned_index(), last_returned_index[handle]) @staticmethod def _make_table_name(name): return table_prefix + name