Esempio n. 1
0
 def setUp(self):
     super(TestConsulPatch, self).setUp()
     patch()
     c = consul.Consul(
         host=CONSUL_CONFIG["host"],
         port=CONSUL_CONFIG["port"],
     )
     Pin.override(consul.Consul, service=self.TEST_SERVICE, tracer=self.tracer)
     Pin.override(consul.Consul.KV, service=self.TEST_SERVICE, tracer=self.tracer)
     self.c = c
Esempio n. 2
0
    def test_patch_idempotence(self):
        key = 'test/patch/idempotence'

        patch()
        patch()

        self.c.kv.get(key)
        assert self.spans
        assert isinstance(self.c.kv.get, BoundFunctionWrapper)

        unpatch()
        self.reset()

        self.c.kv.get(key)
        assert not self.spans
        assert not isinstance(self.c.kv.get, BoundFunctionWrapper)