Fix flaky test: TestO11y/http_with_token #1248
Open
+10
−0
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.
📋 Tests Fixed
o11y/otel/otel_test.go
: Fixed race condition inTestO11y/http_with_token
subtest by adding proper polling pattern for trace retrieval from JaegerNone. The single analyzed test was successfully fixed.
🛠️ Types of Changes Made
🔍 Common Patterns Identified
The test exhibited timing-based flakiness due to a race condition between trace creation/flushing and trace retrieval from Jaeger. The fix involved implementing a proven polling pattern already used elsewhere in the codebase.
✅ Expected Impact
This targeted fix should improve test reliability by addressing the race condition where the "find trace" subtest was directly querying Jaeger without waiting for traces to be indexed, causing intermittent failures when Jaeger hadn't processed the traces yet.
Total Tests Analyzed: 1 | Successfully Fixed: 1 | Test Files Modified: 1 | Total Cost: $0.89 | Generated: 2025-08-06