Skip to content

Commit 3bcc9fb

Browse files
avzissrikanthccv
andauthored
add a test for pymemcache using NoOpTracerProvider (#1650)
Co-authored-by: Srikanth Chekuri <[email protected]>
1 parent df32e8c commit 3bcc9fb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,19 @@ def test_uninstrumented(self):
509509

510510
PymemcacheInstrumentor().instrument()
511511

512+
def test_no_op_tracer_provider(self):
513+
PymemcacheInstrumentor().uninstrument()
514+
tracer_provider = trace_api.NoOpTracerProvider()
515+
PymemcacheInstrumentor().instrument(tracer_provider=tracer_provider)
516+
517+
client = self.make_client([b"STORED\r\n"])
518+
result = client.set(b"key", b"value", noreply=False)
519+
self.assertTrue(result)
520+
521+
spans = self.memory_exporter.get_finished_spans()
522+
assert spans is not None
523+
self.assertEqual(len(spans), 0)
524+
512525

513526
class PymemcacheHashClientTestCase(TestBase):
514527
"""Tests for a patched pymemcache.client.hash.HashClient."""

0 commit comments

Comments
 (0)