def test_release(self): try: conn = Connection() conn.open('127.0.0.1', 3699, 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 except Exception as ex: assert False, ex
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_release(self): 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, '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 test_signout_and_execute(self): try: conn = Connection() conn.open(self.addr_host1, self.addr_port1, 3000) session_id = conn.authenticate(self.user, self.password) conn.signout(session_id) except Exception as e: assert False, e.message time.sleep(2) resp = conn.execute(session_id, 'SHOW HOSTS') assert resp.error_code == ttypes.ErrorCode.E_SESSION_INVALID, resp.error_msg assert resp.error_msg.find(b'Session not existed!') > 0