Skip to content

test/bbr: fix startup race condition and IPv6 address formatting#1987

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
LukeAVanDrie:refactor/epp-hermetic-tests
Dec 10, 2025
Merged

test/bbr: fix startup race condition and IPv6 address formatting#1987
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
LukeAVanDrie:refactor/epp-hermetic-tests

Conversation

@LukeAVanDrie
Copy link
Copy Markdown
Contributor

@LukeAVanDrie LukeAVanDrie commented Dec 10, 2025

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 refused failures 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 via net.Listen.

The Fix:

  1. Readiness Polling: Implements a require.Eventually loop that attempts to net.Dial the target address. The test now blocks until the OS confirms the socket is open and listening before proceeding to gRPC initialization.
  2. IPv6 Safety: Replaces manual string formatting (fmt.Sprintf("%s:%d")) with net.JoinHostPort. This ensures that IPv6 addresses returned by GetFreePort (e.g., ::1) are correctly bracketed (e.g., [::1]:port), preventing "too many colons in address" errors on dual-stack CI hosts.

Verified with:

go test ./test/integration/bbr/... \
  -run "TestFullDuplexStreamed_BodyBasedRouting" \
  -count 100 \
  -failfast \
  -v

Which issue(s) this PR fixes:
TODO: flake report not filed yet. Will link it shortly.

Does this PR introduce a user-facing change?:

NONE

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`).
@k8s-ci-robot k8s-ci-robot added the kind/flake Categorizes issue or PR as related to a flaky test. label Dec 10, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@LukeAVanDrie: The label(s) kind/test cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?
/kind flake
/kind test

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 refused failures 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 via net.Listen.

The Fix:

  1. Readiness Polling: Implements a require.Eventually loop that attempts to net.Dial the target address. The test now blocks until the OS confirms the socket is open and listening before proceeding to gRPC initialization.
  2. IPv6 Safety: Replaces manual string formatting (fmt.Sprintf("%s:%d")) with net.JoinHostPort. This ensures that IPv6 addresses returned by GetFreePort (e.g., ::1) are correctly bracketed (e.g., [::1]:port), preventing "too many colons in address" errors on dual-stack CI hosts.

Verified with:

go test ./test/integration/bbr/... \
 -run "TestFullDuplexStreamed_BodyBasedRouting" \
 -count 100 \
 -failfast \
 -v

Which issue(s) this PR fixes:
TODO: flake report not filed yet. Will link it shortly.

Does this PR introduce a user-facing change?:

NONE

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.

@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 10, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 5f2dc61
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6939ecf62d55ce0008dc6bbc
😎 Deploy Preview https://deploy-preview-1987--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 10, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 10, 2025
@ahg-g
Copy link
Copy Markdown
Contributor

ahg-g commented Dec 10, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 10, 2025
@ahg-g
Copy link
Copy Markdown
Contributor

ahg-g commented Dec 10, 2025

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 10, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 10, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4371652 into kubernetes-sigs:main Dec 10, 2025
15 checks passed
nirrozenbaum pushed a commit to llm-d/llm-d-inference-payload-processor that referenced this pull request Apr 28, 2026
…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`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/flake Categorizes issue or PR as related to a flaky test. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants