Repository navigation
test(redir): wait for relay handlers before tests reuse shared config - #1332
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only change correctly waits for relay handlers before shared configuration is reused.
No open issues 🎉
What changed in this PR
Fixes an intermittent test race by waiting for relay handlers to finish before subsequent tests reuse shared configuration.
Changes:
- Tracks active HTTP handlers with a wait group.
- Waits for handler completion during test cleanup; production code is unchanged.
| File | Description |
|---|---|
internal/controller/ws/v1/redirect_test.go |
Adds handler tracking and cleanup synchronization to the real-upgrader test. |
Review effort: Balanced
TestWebSocketHandlerRealUpgrader returned while hijacked relay handlers were still reading config.ConsoleConfig, racing TestWebSocketHandlerTokenValidation's config.NewConfig() under -race. httptest.Server.Close does not wait for hijacked connections, so the test now tracks in-flight handlers and waits for them in cleanup.
rsdmike
force-pushed
the
test/relay-handler-race
branch
from
October 16, 2026 22:03
c750634 to
480d3d9
Compare
rsdmike
enabled auto-merge (squash)
October 16, 2026 22:04
graikhel-intel
approved these changes
Oct 16, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1332 +/- ##
=======================================
Coverage 62.24% 62.24%
=======================================
Files 159 159
Lines 13417 13417
=======================================
Hits 8351 8351
Misses 5066 5066 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TestWebSocketHandlerRealUpgrader (added in #1236) returns while hijacked relay handlers are still reading config.ConsoleConfig at redirect.go:75. The next test, TestWebSocketHandlerTokenValidation, calls config.NewConfig() and the race detector fails the run. This has failed main CI intermittently since 2026-09-25.
httptest.Server.Close does not wait for hijacked connections, so the test now wraps the router to track in-flight handlers and waits for them in cleanup. Test-only change.