Fix flaky test: TestO11y/http_with_token/find_trace #1249
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔧 Flaky Tests Analysis & Fixes
This PR contains a fix for one flaky test that was causing reliability issues due to timing-based race conditions in OpenTelemetry trace processing.
📋 Tests Fixed
o11y/otel/otel_test.go
: Fixed timing-based flakiness inTestO11y/http_with_token/find_trace
by replacing immediate Jaeger query with proper polling mechanism to wait for traces to be availableNone - the single identified flaky test was successfully analyzed and fixed.
🛠️ Types of Changes Made
poll.WaitOn
pattern to eliminate race condition🔍 Common Patterns Identified
The flakiness was caused by a classic timing issue where the test queried Jaeger for traces immediately after sending them, but before they were fully flushed and indexed in the backend. This created a race condition where the test would sometimes find the trace and sometimes not.
✅ Expected Impact
These targeted fixes should improve test reliability by addressing timing-based race conditions in OpenTelemetry trace processing and ensuring proper synchronization with the Jaeger backend.
Total Tests Analyzed: 1 | Successfully Fixed: 1 | Test Files Modified: 1 | Total Cost: $0.91 | Generated: 2025-08-06