Skip to content

Commit

Permalink
Update nooptracer test to assert that no spans are produced.
Browse files Browse the repository at this point in the history
Signed-off-by: kaushik95 <[email protected]>
  • Loading branch information
kaushik95 authored Sep 3, 2024
1 parent 58503a2 commit 3361c46
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,13 @@ def test_sqlcommenter_disabled(self, event_mocked):
kwargs = event_mocked.call_args[1]
self.assertEqual(kwargs["enable_commenter"], False)

@mock.patch("opentelemetry.instrumentation.dbapi.wrap_connect")
def test_sqlcommenter_enabled_no_op_tracer(self, event_mocked):
cnx = psycopg2.connect(database="test")
def test_no_op_tracer_provider(self):
Psycopg2Instrumentor().instrument(
tracer_provider=trace.NoOpTracerProvider(), enable_commenter=True
tracer_provider=trace.NoOpTracerProvider()
)
query = "SELECT * FROM test"
cnx = psycopg2.connect(database="test")
cursor = cnx.cursor()
query = "SELECT * FROM test"
cursor.execute(query)
kwargs = event_mocked.call_args[1]
self.assertEqual(kwargs["enable_commenter"], True)
spans_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans_list), 0)

0 comments on commit 3361c46

Please sign in to comment.