From e23dd5c25ad01bfc7d36f1862a3abc70901a5780 Mon Sep 17 00:00:00 2001 From: avzis <107620508+avzis@users.noreply.github.com> Date: Wed, 18 Jan 2023 12:11:46 +0200 Subject: [PATCH] add a test for urllib3 using NoOpTracerProvider (#1574) --- .../tests/test_urllib3_integration.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py index ed2f314dc..2946cb767 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_integration.py @@ -330,3 +330,12 @@ class TestURLLib3Instrumentor(TestBase): self.assertIn("request_hook_body", span.attributes) self.assertEqual(span.attributes["request_hook_body"], body) + + def test_no_op_tracer_provider(self): + URLLib3Instrumentor().uninstrument() + tracer_provider = trace.NoOpTracerProvider() + URLLib3Instrumentor().instrument(tracer_provider=tracer_provider) + + response = self.perform_request(self.HTTP_URL) + self.assertEqual(b"Hello!", response.data) + self.assert_span(num_spans=0)