-
Notifications
You must be signed in to change notification settings - Fork 206
test/integration: introduce robust harness and migrate BBR suite #1959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
test/integration: introduce robust harness and migrate BBR suite #1959
Conversation
Introduces a robust testing DSL for gRPC streaming scenarios and fixes a concurrency bug in the legacy test utilities. Key Improvements: - **DSL:** Adds high-level request builders (`ReqLLM`, `ReqRaw`) to create readable, intent-based test cases. - **Race Fix:** Refactors `StreamedRequest` to use a serial read loop. Previously, concurrent `Recv()` calls caused undefined behavior that masked server responses. - **Robustness:** Updates `GetFreePort` to prevent race conditions during parallel test execution. **Note on EPP Tests:** The race condition fix in `StreamedRequest` stabilized the test output, revealing an incorrect assertion in `test/integration/epp/hermetic_test.go`. The server correctly returns a generic 400 error without echoing the invalid body (security best practice), but the test expected the body to be echo'd. The assertion has been updated to match the correct, stable server behavior.
Introduces the `BBRHarness` struct to manage isolated BBR server instances, laying the groundwork for parallel integration testing. Features: - **Isolation:** Spawns a dedicated server per test on a random loopback port. - **Helpers:** Provides BBR-specific assertion helpers (e.g., `ExpectBBRHeader`) to reduce protobuf boilerplate. - **Safety:** Ensures proper server shutdown and resource cleanup via `t.Cleanup`.
Refactors `hermetic_test.go` to use the new `BBRHarness` and DSL, reducing boilerplate and execution time. Changes: - Replaces manual gRPC setup with declarative, table-driven test cases. - Enables `t.Parallel()` for all BBR test cases, as the new harness provides full network isolation. - Removes legacy `setUpHermeticServer` helper in favor of the new harness.
|
@LukeAVanDrie: The label(s) In 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. |
|
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. 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. |
|
/ok-to-test |
|
This is great. /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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
This is the EPP test case I changed. It looks like it is still non-deterministic. Locally, it never plumbs ": no healthy upstream" with the error, but in CI/CD it does. I need to take a deeper look into the new utils to see why this isn't fully resolved. Else, BBR tests are working as expected in CI. Should hopefully be a small change I will patch Monday morning. |
|
/retest This is likely to fail again, but I am trying to isolate whether this is general non-determinism or an environment issue. It's also possible that it's the EPP code itself that's nondeterministic, not the test suite. |
|
@LukeAVanDrie: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
Found it! It is non-determinism in the server code. In server.go: The error message returned to the client depends on the logger verbosity level ( My local run uses likely doesn't run with DEBUG level, so it returns the generic message. The CI environment likely runs tests with higher verbosity, enabling DEBUG. This causes the server to branch into the more detailed error path, echoing the body. IMO, public API responses should not change based on internal logging flags. It could cause clients to break unpredictably and leaks implementation details. Thoughts on making this change? |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This PR overhauls the integration testing infrastructure to introduce a type-safe DSL, eliminate concurrency race conditions, and enable full test parallelism.
As a reference implementation for this new architecture, the Body-Based Routing (BBR) test suite has been fully migrated to the new harness. This lays the groundwork for an upcoming, larger migration of the Endpoint Picker (EPP) test suite.
Key Improvements
ReqLLM,ReqRaw) and assertions (ExpectBBRHeader) to decouple test intent from gRPC protocol boilerplate. This significantly reduces code noise in table-driven tests.BBRHarness, which spins up a dedicated server instance on a random loopback port for every single test case.localhostbindings with strict127.0.0.1to prevent IPv4/IPv6 race conditions in CI.t.Parallel()for all BBR tests, reducing execution time.StreamedRequestutility to use a serial read loop. The previous implementation spawned concurrent goroutines to read from the same gRPC stream, leading to undefined behavior that masked server response errors.Impact on Existing Tests
StreamedRequest(removing the race condition) stabilized the test output, revealing an incorrect assertion intest/integration/epp/hermetic_test.go. The server correctly returns a400 Bad Requestwithout echoing the invalid body (a security best practice), but the legacy test expected the echo. The assertion has been updated to match the correct, stable server behavior.Which issue(s) this PR fixes:
N/A -- groundwork for
test/integration/epp/hermetic_test.gorefactoring which is necessary to support Flow Control tests which require mutating pod state (for changing pool saturation).Does this PR introduce a user-facing change?: