def get_connection(ip, port): ssl_config = self.client_pool._ssl_configs try: conn = Connection() conn.open_SSL(ip, port, 0, ssl_config) except Exception as ex: assert False, 'Create connection to {}:{} failed'.format( ip, port) return conn
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_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_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