Skip to content

Commit

Permalink
add a test for pymongo with NoOpTracer (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
avzis authored Dec 27, 2022
1 parent ddbc40f commit 15ee4a0
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ def test_int_command(self):
span = spans_list[0]
self.assertEqual(span.name, "database_name.command_name")

def test_no_op_tracer(self):
mock_event = MockEvent({})

tracer = trace_api.NoOpTracer()
command_tracer = CommandTracer(tracer)
command_tracer.started(event=mock_event)
command_tracer.succeeded(event=mock_event)

spans_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans_list), 0)


class MockCommand:
def __init__(self, command_attrs):
Expand Down

0 comments on commit 15ee4a0

Please sign in to comment.