Skip to content

Commit 93c4004

Browse files
committed
Fix CI test failure: Clear _flush_event between tests
The _flush_event threading.Event was never cleared after stopping the flush thread, remaining in "set" state. This caused timing issues in subsequent tests where the Event was already signaled, triggering unexpected flush behavior and causing extra telemetry events to be captured (88 instead of 60). Now explicitly clear the _flush_event flag in both setup (before test) and teardown (after test) to ensure clean state isolation between tests. This explains why CI consistently got 88 events - the flush_event from previous tests triggered additional flushes during test execution. Signed-off-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8b5a402 commit 93c4004

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tests/e2e/test_concurrent_telemetry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def telemetry_setup_teardown(self):
4141
TelemetryClientFactory._executor.shutdown(wait=True)
4242
TelemetryClientFactory._executor = None
4343
TelemetryClientFactory._stop_flush_thread()
44+
TelemetryClientFactory._flush_event.clear() # Clear the event flag
4445
TelemetryClientFactory._clients.clear()
4546
TelemetryClientFactory._initialized = False
4647

@@ -52,6 +53,7 @@ def telemetry_setup_teardown(self):
5253
TelemetryClientFactory._executor.shutdown(wait=True)
5354
TelemetryClientFactory._executor = None
5455
TelemetryClientFactory._stop_flush_thread()
56+
TelemetryClientFactory._flush_event.clear() # Clear the event flag
5557
TelemetryClientFactory._clients.clear()
5658
TelemetryClientFactory._initialized = False
5759

tests/e2e/test_telemetry_e2e.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def telemetry_setup_teardown(self):
5656
TelemetryClientFactory._executor.shutdown(wait=True)
5757
TelemetryClientFactory._executor = None
5858
TelemetryClientFactory._stop_flush_thread()
59+
TelemetryClientFactory._flush_event.clear() # Clear the event flag
5960
TelemetryClientFactory._clients.clear()
6061
TelemetryClientFactory._initialized = False
6162

@@ -75,6 +76,7 @@ def telemetry_setup_teardown(self):
7576
TelemetryClientFactory._executor.shutdown(wait=True)
7677
TelemetryClientFactory._executor = None
7778
TelemetryClientFactory._stop_flush_thread()
79+
TelemetryClientFactory._flush_event.clear() # Clear the event flag
7880
TelemetryClientFactory._clients.clear()
7981
TelemetryClientFactory._initialized = False
8082

0 commit comments

Comments
 (0)