Repository navigation
test(launcher): make WaitForURL late-bind test immune to port reuse - #1816
Merged
Merged
Conversation
TestWaitForURL_BoundLate reserved a port, released it, and re-bound it
400ms later; under parallel `go test -race ./...` another process grabbed
the port in that window ("bind: address already in use"). NeverBound and
ContextCanceled used the same reserve-and-release pattern and could pass or
fail spuriously if a stray listener took the port.
Drive WaitForURLWithDial through a dial func that refuses until a deadline
instead. BoundLate keeps its listener bound for the whole test so the port
cannot be stolen; the other two no longer touch a real port. No change to
WaitForURL itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Deploying mcpproxy-docs with
|
| Latest commit: |
187b4af
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e5e1f143.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://claude-admiring-cartwright-5.mcpproxy-docs.pages.dev |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 41474934043 --repo smart-mcp-proxy/mcpproxy-go
|
BoundLate now refuses a fixed number of initial dial attempts (not a wall-clock window) and asserts exactly refusals+1 attempts, with generous timeouts. NeverBound only asserts the one guaranteed attempt, since a loaded runner may delay the goroutine past the short deadline after a single dial; its upper elapsed bound is also loosened. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Dumbris
enabled auto-merge (squash)
November 2, 2026 17:45
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.
Summary
TestWaitForURL_BoundLatereserved127.0.0.1:0, closed it, then re-bound 400 ms later. On CI another process/test took the port first (bind: address already in use, seen on fix(scanner): inspect only the scanned server's tools, keep peers as index context #1812), failing the E2E job.NeverBoundandContextCanceledused the same reserve-and-release pattern and could pass/fail spuriously if a stray listener took the port.WaitForURLWithDialwith a dial func that refuses (ECONNREFUSED) until a deadline.BoundLateholds its listener for the whole test so the port can't be stolen; the other two use no real port. Portable across darwin/linux/windows (cross-vet clean).WaitForURLitself is unchanged, so no CHANGELOG entry.Test plan
go test -race -count=50 -run TestWaitForURL ./internal/upstream/launcher/go test -race ./internal/upstream/launcher/golangci-lint run --config .github/.golangci.yml ./internal/upstream/launcher/— 0 issuesGOOS=windows go vet,GOOS=linux go vet🤖 Generated with Claude Code