예제 #1
0
파일: test.py 프로젝트: tebriel/dd-trace-py
    def test_patch_unpatch(self):
        tracer = get_dummy_tracer()
        writer = tracer.writer
        url = "%s:%s" % (cfg["host"], cfg["port"])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(
            service=self.TEST_SERVICE,
            tracer=tracer).onto(client)

        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set("a", 1)

        spans = writer.pop()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=tracer).onto(client)
        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)
예제 #2
0
파일: test.py 프로젝트: zapier/dd-trace-py
    def test_patch_unpatch(self):
        tracer = get_dummy_tracer()
        writer = tracer.writer
        url = "%s:%s" % (cfg["host"], cfg["port"])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(service=self.TEST_SERVICE,
                                   tracer=tracer).onto(client)

        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set("a", 1)

        spans = writer.pop()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=tracer).onto(client)
        client.set("a", 1)

        spans = writer.pop()
        assert spans, spans
        eq_(len(spans), 1)
예제 #3
0
파일: test.py 프로젝트: zhammer/dd-trace-py
    def test_patch_unpatch(self):
        url = '%s:%s' % (cfg['host'], cfg['port'])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(
            service=self.TEST_SERVICE,
            tracer=self.tracer).onto(client)

        client.set('a', 1)

        spans = self.tracer.writer.pop()
        assert spans, spans
        assert len(spans) == 1

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set('a', 1)

        spans = self.tracer.writer.pop()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(client)
        client.set('a', 1)

        spans = self.tracer.writer.pop()
        assert spans, spans
        assert len(spans) == 1
예제 #4
0
파일: test.py 프로젝트: jalaziz/dd-trace-py
    def test_patch_unpatch(self):
        url = "%s:%s" % (cfg["host"], cfg["port"])

        # Test patch idempotence
        patch()
        patch()

        client = pylibmc.Client([url])
        Pin.get_from(client).clone(service=self.TEST_SERVICE,
                                   tracer=self.tracer).onto(client)

        client.set("a", 1)

        spans = self.pop_spans()
        assert spans, spans
        assert len(spans) == 1

        # Test unpatch
        unpatch()

        client = pylibmc.Client([url])
        client.set("a", 1)

        spans = self.pop_spans()
        assert not spans, spans

        # Test patch again
        patch()

        client = pylibmc.Client([url])
        Pin(service=self.TEST_SERVICE, tracer=self.tracer).onto(client)
        client.set("a", 1)

        spans = self.pop_spans()
        assert spans, spans
        assert len(spans) == 1
예제 #5
0
파일: test.py 프로젝트: depop/dd-trace-py
 def setUp(self):
     super(TestPylibmcPatchDefault, self).setUp()
     patch()
예제 #6
0
파일: test.py 프로젝트: zapier/dd-trace-py
 def setUp(self):
     patch()
예제 #7
0
파일: test.py 프로젝트: tebriel/dd-trace-py
 def setUp(self):
     patch()