def test_client_orphan_session(self): """ Tests that a client makes it into the session store without a tracer attaching if attach_timeout is set to ALLOW_ORPHANS or 0. """ with QdbServer(tracer_server=QdbNopServer(), client_host='localhost', client_port=0, attach_timeout=ALLOW_ORPHANS) as server: client = create_connection( 'ws://localhost:%d%s' % (server.client_server.server_port, DEFAULT_ROUTE_FMT.format(uuid='test')) ) send_client_event(client, 'start', '') # yield to the session_store to let it get attached. gevent.sleep(0.01) self.assertIn('test', server.session_store)
def test_tracer_orphan_session(self): """ Tests that a tracer makes it into the session_store without a client attaching if attach_timeout is set to ALLOW_ORPHANS or 0. """ with QdbServer(client_server=QdbNopServer(), tracer_host='localhost', tracer_port=0, attach_timeout=ALLOW_ORPHANS) as server: tracer = gevent.socket.create_connection( ('localhost', server.tracer_server.server_port) ) send_tracer_event(tracer, 'start', { 'uuid': 'test', 'auth': '', 'local': (0, 0), }) # yield to the session_store to let it get attached. gevent.sleep(0.01) self.assertIn('test', server.session_store)