def setup_class(cls): # create schema try: conn = Connection() conn.open('127.0.0.1', 9669, 1000) auth_result = conn.authenticate('root', 'nebula') session_id = auth_result.get_session_id() assert session_id != 0 resp = conn.execute( session_id, 'CREATE SPACE IF NOT EXISTS test_meta_cache1(REPLICA_FACTOR=3, vid_type=FIXED_STRING(8));' 'USE test_meta_cache1;' 'CREATE TAG IF NOT EXISTS tag11(name string);' 'CREATE EDGE IF NOT EXISTS edge11(name string);' 'CREATE SPACE IF NOT EXISTS test_meta_cache2(vid_type=FIXED_STRING(8));' 'USE test_meta_cache2;' 'CREATE TAG IF NOT EXISTS tag22(name string);' 'CREATE EDGE IF NOT EXISTS edge22(name string);') assert resp.error_code == 0 conn.close() time.sleep(10) cls.meta_cache = MetaCache([('127.0.0.1', 9559), ('127.0.0.1', 9560), ('127.0.0.1', 9560)], 50000) except Exception as x: import traceback print(traceback.format_exc()) assert False
def test_create(self): try: conn = Connection() conn.open('127.0.0.1', 9669, 1000) auth_result = conn.authenticate('root', 'nebula') assert auth_result.get_session_id() != 0 conn.close() except Exception as ex: assert False, ex
def test_create(self): try: conn = Connection() conn.open('127.0.0.1', 3699, 1000) session_id = conn.authenticate('root', 'nebula') assert session_id != 0 conn.close() except Exception as ex: assert False, ex
def test_create_self_signed(self): try: conn = Connection() conn.open_SSL(host, port, 1000, ssl_selfs_signed_config) auth_result = conn.authenticate('root', 'nebula') assert auth_result.get_session_id() != 0 conn.close() except Exception as ex: assert False, ex
def test_close(self): conn = Connection() conn.open('127.0.0.1', 9669, 1000) auth_result = conn.authenticate('root', 'nebula') assert auth_result.get_session_id() != 0 conn.close() try: conn.authenticate('root', 'nebula') except IOErrorException: assert True
def test_close(self): conn = Connection() conn.open('127.0.0.1', 3699, 1000) session_id = conn.authenticate('root', 'nebula') assert session_id != 0 conn.close() try: conn.authenticate('root', 'nebula') except IOErrorException: assert True
def test_close(self): conn = Connection() conn.open_SSL(host, port, 1000, ssl_config) auth_result = conn.authenticate('root', 'nebula') assert auth_result.get_session_id() != 0 conn.close() try: conn.authenticate('root', 'nebula') except IOErrorException: assert True
def test_release(self): try: conn = Connection() conn.open('127.0.0.1', 9669, 1000) session_id = conn.authenticate('root', 'nebula') assert session_id != 0 resp = conn.execute(session_id, 'SHOW SPACES') assert resp.error_code == ttypes.ErrorCode.SUCCEEDED, resp.error_msg conn.signout(session_id) resp = conn.execute(session_id, 'SHOW SPACES') assert resp.error_code != ttypes.ErrorCode.SUCCEEDED conn.close() except Exception as ex: assert False, ex
def test_release_self_signed(self): try: conn = Connection() conn.open_SSL(host, port, 1000, ssl_selfs_signed_config) auth_result = conn.authenticate('root', 'nebula') session_id = auth_result.get_session_id() assert session_id != 0 resp = conn.execute(session_id, 'SHOW SPACES') assert resp.error_code == ttypes.ErrorCode.SUCCEEDED, resp.error_msg conn.signout(session_id) # the session delete later time.sleep(12) resp = conn.execute(session_id, 'SHOW SPACES') assert resp.error_code != ttypes.ErrorCode.SUCCEEDED conn.close() except Exception as ex: assert False, ex
def setup_class(cls): try: conn = Connection() conn.open('127.0.0.1', 9671, 3000) auth_result = conn.authenticate('root', 'nebula') session_id = auth_result.get_session_id() assert session_id != 0 cls.execute_with_retry(conn, session_id, 'CREATE SPACE IF NOT EXISTS test_graph_storage_client(' 'PARTITION_NUM=10,' 'REPLICA_FACTOR=1,' 'vid_type=FIXED_STRING(20));' 'USE test_graph_storage_client;' 'CREATE TAG IF NOT EXISTS person(name string, age int);' 'CREATE EDGE IF NOT EXISTS friend(start int, end int);') time.sleep(5) for id in range(1000): vid = 'person' + str(id) cmd = 'INSERT VERTEX person(name, age) ' \ 'VALUES \"{}\":(\"{}\", {})'.format(vid, vid, id) cls.execute_with_retry(conn, session_id, cmd) for id in range(1000): src_id = 'person' + str(id) dst_id = 'person' + str(1000 - id) start = random.randint(2000, 2010) end = random.randint(2010, 2020) cmd = 'INSERT EDGE friend(start, end) ' \ 'VALUES \"{}\"->\"{}\":({}, {})'.format(src_id, dst_id, start, end) cls.execute_with_retry(conn, session_id, cmd) conn.close() meta_cache = MetaCache([('172.28.1.1', 9559), ('172.28.1.2', 9559), ('172.28.1.3', 9559)], 50000) cls.graph_storage_client = GraphStorageClient(meta_cache) except Exception: import traceback print(traceback.format_exc()) assert False