Skip to content

Commit 4cf3c3c

Browse files
Improve testing:
Test that: - processor works after call to force_flush() - shutdown() flushes the processor
1 parent e83c490 commit 4cf3c3c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

opentelemetry-sdk/tests/trace/export/test_export.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,25 @@ def test_batch_span_processor(self):
103103
my_exporter = MySpanExporter(destination=spans_names_list)
104104
span_processor = export.BatchExportSpanProcessor(my_exporter)
105105

106-
span_names = ["xxx", "bar", "foo"]
106+
span_names0 = ["xxx", "bar", "foo"]
107+
span_names1 = ["yyy", "baz", "fox"]
107108

108-
for name in span_names:
109+
for name in span_names0:
109110
_create_start_and_end_span(name, span_processor)
110111

111112
span_processor.force_flush()
112-
self.assertListEqual(span_names, spans_names_list)
113+
self.assertListEqual(span_names0, spans_names_list)
114+
115+
# create some more spans to check that span processor still works
116+
for name in span_names1:
117+
_create_start_and_end_span(name, span_processor)
113118

114119
span_processor.shutdown()
115120
self.assertTrue(my_exporter.is_shutdown)
116121

122+
# check that processor is flushed after shutdown()
123+
self.assertListEqual(span_names0 + span_names1, spans_names_list)
124+
117125
def test_batch_span_processor_lossless(self):
118126
"""Test that no spans are lost when sending max_queue_size spans"""
119127
spans_names_list = []

0 commit comments

Comments
 (0)