def test_patch_unpatch(self): tracer = get_dummy_tracer() writer = tracer.writer # Test patch idempotence patch() patch() client = pymongo.MongoClient(port=MONGO_CONFIG['port']) Pin.get_from(client).clone(tracer=tracer).onto(client) client['testdb'].drop_collection('whatever') spans = writer.pop() assert spans, spans assert len(spans) == 1 # Test unpatch unpatch() client = pymongo.MongoClient(port=MONGO_CONFIG['port']) client['testdb'].drop_collection('whatever') spans = writer.pop() assert not spans, spans # Test patch again patch() client = pymongo.MongoClient(port=MONGO_CONFIG['port']) Pin.get_from(client).clone(tracer=tracer).onto(client) client['testdb'].drop_collection('whatever') spans = writer.pop() assert spans, spans assert len(spans) == 1
def test_patch_unpatch(self): tracer = get_dummy_tracer() writer = tracer.writer # Test patch idempotence patch() patch() client = pymongo.MongoClient(port=MONGO_CONFIG['port']) Pin.get_from(client).clone(tracer=tracer).onto(client) client["testdb"].drop_collection("whatever") spans = writer.pop() assert spans, spans eq_(len(spans), 1) # Test unpatch unpatch() client = pymongo.MongoClient(port=MONGO_CONFIG['port']) client["testdb"].drop_collection("whatever") spans = writer.pop() assert not spans, spans # Test patch again patch() client = pymongo.MongoClient(port=MONGO_CONFIG['port']) Pin.get_from(client).clone(tracer=tracer).onto(client) client["testdb"].drop_collection("whatever") spans = writer.pop() assert spans, spans eq_(len(spans), 1)
def test_patch_unpatch(self): # Test patch idempotence patch() patch() client = pymongo.MongoClient(port=MONGO_CONFIG["port"]) Pin.get_from(client).clone(tracer=self.tracer).onto(client) # We do not wish to trace tcp spans here Pin.get_from(pymongo.server.Server).remove_from(pymongo.server.Server) client["testdb"].drop_collection("whatever") spans = self.pop_spans() assert spans, spans assert len(spans) == 1 # Test unpatch unpatch() client = pymongo.MongoClient(port=MONGO_CONFIG["port"]) client["testdb"].drop_collection("whatever") spans = self.pop_spans() assert not spans, spans # Test patch again patch() client = pymongo.MongoClient(port=MONGO_CONFIG["port"]) Pin.get_from(client).clone(tracer=self.tracer).onto(client) # We do not wish to trace tcp spans here Pin.get_from(pymongo.server.Server).remove_from(pymongo.server.Server) client["testdb"].drop_collection("whatever") spans = self.pop_spans() assert spans, spans assert len(spans) == 1
def tearDown(self): unpatch()
def tearDown(self): unpatch() self.client.close() super(TestPymongoSocketTracing, self).tearDown()
def tearDown(self): unpatch() super(TestPymongoPatchConfigured, self).tearDown()
def tearDown(self): unpatch()
def tearDown(self): unpatch() self.client.close()