test/bbr: fix startup race condition and IPv6 address formatting#1987
Conversation
Fixes a race condition where the test harness attempted to dial the gRPC server before the background goroutine had successfully bound the port via `net.Listen`. Changes: - Adds a readiness check that polls `net.Dial` before initializing the gRPC client. - Uses `net.JoinHostPort` instead of `fmt.Sprintf` to ensure IPv6 addresses are correctly bracketed (e.g., `[::1]:port`).
|
@LukeAVanDrie: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @LukeAVanDrie. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, LukeAVanDrie The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…ay-api-inference-extension#1987) Fixes a race condition where the test harness attempted to dial the gRPC server before the background goroutine had successfully bound the port via `net.Listen`. Changes: - Adds a readiness check that polls `net.Dial` before initializing the gRPC client. - Uses `net.JoinHostPort` instead of `fmt.Sprintf` to ensure IPv6 addresses are correctly bracketed (e.g., `[::1]:port`).
What type of PR is this?
/kind flake
What this PR does / why we need it:
This PR fixes a race condition in the Body-Based Routing (BBR) integration test harness that caused intermittent
connect: connection refusedfailures in CI.The Problem:
The test harness spawned the BBR server in a goroutine and immediately attempted to dial it via
grpc.NewClient. In CI environments, the main test thread may execute the dial attempt before the server goroutine could initialize and successfully bind the TCP socket vianet.Listen.The Fix:
require.Eventuallyloop that attempts tonet.Dialthe target address. The test now blocks until the OS confirms the socket is open and listening before proceeding to gRPC initialization.fmt.Sprintf("%s:%d")) withnet.JoinHostPort. This ensures that IPv6 addresses returned byGetFreePort(e.g.,::1) are correctly bracketed (e.g.,[::1]:port), preventing "too many colons in address" errors on dual-stack CI hosts.Verified with:
Which issue(s) this PR fixes:
TODO: flake report not filed yet. Will link it shortly.
Does this PR introduce a user-facing change?: