Skip to content

Commit 176cb73

Browse files
committed
Addressing comments
1 parent 3a902e1 commit 176cb73

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ext/opentelemetry-ext-docker-tests/tests/pymongo/test_pymongo_functional.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def setUpClass(cls):
5050
def setUp(self):
5151
self._span_exporter.clear()
5252

53-
def validate_spans(self, spans: typing.Tuple[Span]):
53+
def validate_spans(self):
54+
spans = self._span_exporter.get_finished_spans()
5455
self.assertEqual(len(spans), 2)
5556
for span in spans:
5657
if span.name == "rootSpan":
@@ -59,6 +60,8 @@ def validate_spans(self, spans: typing.Tuple[Span]):
5960
pymongo_span = span
6061
self.assertIsInstance(span.start_time, int)
6162
self.assertIsInstance(span.end_time, int)
63+
self.assertIsNot(root_span, None)
64+
self.assertIsNot(pymongo_span, None)
6265
self.assertIsNotNone(pymongo_span.parent)
6366
self.assertEqual(pymongo_span.parent.name, root_span.name)
6467
self.assertIs(pymongo_span.kind, trace_api.SpanKind.CLIENT)
@@ -79,7 +82,7 @@ def test_insert(self):
7982
self._collection.insert_one(
8083
{"name": "testName", "value": "testValue"}
8184
)
82-
self.validate_spans(self._span_exporter.get_finished_spans())
85+
self.validate_spans()
8386

8487
def test_update(self):
8588
"""Should create a child span for update
@@ -88,18 +91,18 @@ def test_update(self):
8891
self._collection.update_one(
8992
{"name": "testName"}, {"$set": {"value": "someOtherValue"}}
9093
)
91-
self.validate_spans(self._span_exporter.get_finished_spans())
94+
self.validate_spans()
9295

9396
def test_find(self):
9497
"""Should create a child span for find
9598
"""
9699
with self._tracer.start_as_current_span("rootSpan"):
97100
self._collection.find_one()
98-
self.validate_spans(self._span_exporter.get_finished_spans())
101+
self.validate_spans()
99102

100103
def test_delete(self):
101104
"""Should create a child span for delete
102105
"""
103106
with self._tracer.start_as_current_span("rootSpan"):
104107
self._collection.delete_one({"name": "testName"})
105-
self.validate_spans(self._span_exporter.get_finished_spans())
108+
self.validate_spans()

0 commit comments

Comments
 (0)