fix(e2e): RateLimit flaky - #9911
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #9911 +/- ##
==========================================
- Coverage 81.33% 81.31% -0.03%
==========================================
Files 264 264
Lines 40963 40967 +4
==========================================
- Hits 33319 33311 -8
- Misses 7643 7655 +12
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
fccfb64 to
cb0e758
Compare
10da35a to
f373a67
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4a03fe0e6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
e30000b to
a941c12
Compare
fb742f1 to
bd5c301
Compare
Signed-off-by: zirain <zirain2009@gmail.com>
bd5c301 to
b63ff6a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b63ff6af32
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Signed-off-by: zirain <zirain2009@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
Port-forward startup remains unbounded, and the normal E2E fail-fast behavior is disabled.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Improves rate-limit E2E reliability by synchronizing gateway and rate-limit readiness, isolating fixtures, and increasing CI timeout tolerance.
Changes:
- Adds gateway-pod and rate-limit-config readiness polling.
- Isolates rate-limit fixtures with dedicated Gateways and paths.
- Aggregates replica metrics and increases rate-limit RPC timeouts.
File summaries
| File | Description |
|---|---|
test/e2e/tests/utils.go |
Adds readiness/config helpers and multi-pod metrics. |
test/e2e/tests/ratelimit.go |
Uses readiness waits and fail-fast assertions. |
test/e2e/e2e_test.go |
Renames a test reference and alters fail-fast configuration. |
test/e2e/testdata/ratelimit-usage-ratelimit.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-query-parameters.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-path-match.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-multiple-listeners.yaml |
Renames and isolates resources. |
test/e2e/testdata/ratelimit-method-match.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-headers-disabled.yaml |
Isolates Gateway and policy targets. |
test/e2e/testdata/ratelimit-headers-and-cidr-match.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-header-match.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-header-invert-match-global.yaml |
Isolates Gateway and route names. |
test/e2e/testdata/ratelimit-global-shared-gateway-header-match.yaml |
Renames the shared Gateway. |
test/e2e/testdata/ratelimit-global-shared-cidr-match.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-global-shared-and-unshared-header-match.yaml |
Renames the merge-test Gateway. |
test/e2e/testdata/ratelimit-global-shadow-mode.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-cidr-match.yaml |
Adds a Gateway and dedicated path. |
test/e2e/testdata/ratelimit-cidr-invert-match-always-enforce.yaml |
Adds isolated Gateway and path. |
test/e2e/testdata/ratelimit-cidr-invert-always-exempt.yaml |
Adds an isolated Gateway. |
test/e2e/testdata/ratelimit-based-jwt-claims.yaml |
Adds an isolated Gateway. |
test/config/envoy-gateaway-config/xds-name-scheme-v2.yaml |
Sets a one-second rate-limit timeout. |
test/config/envoy-gateaway-config/watch-namespaces.yaml |
Sets a one-second rate-limit timeout. |
test/config/envoy-gateaway-config/gateway-namespace-mode.yaml |
Sets a one-second rate-limit timeout. |
test/config/envoy-gateaway-config/default.yaml |
Sets a one-second rate-limit timeout. |
test/config/envoy-gateaway-config/debounce.yaml |
Sets a one-second rate-limit timeout. |
Review details
- Files reviewed: 25/25 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: zirain <zirain2009@gmail.com>
Fixes: #9994 #9993 #9992
Problem
The rate-limit e2e suite failed intermittently in CI with assertions like "expected 429, got 200" or "expected N matching responses, got M" — not hard errors, just occasional wrong-looking traffic outcomes. Several independent races were compounding to cause this, so tests could fail differently from run to run.
Root causes fixed
Changes
WaitForGatewayPodsReady — waits for the Envoy Proxy pod(s) behind a given Gateway to reach Ready before sending traffic.
WaitForRateLimitDomainToBeLoaded / WaitForRateLimitDomainsToBeLoaded — polls /rlconfig until the domain(s) a test depends on are actually loaded, with a bounded (3s) HTTP client per attempt so a single stuck call can't hang the whole retry loop.
OverLimitCount now sums the metric across all envoy-ratelimit pods instead of just the first, via extracted getOverLimitCount.
1
rateLimit.timeout: 1sadded to all five e2e EnvoyGateway configs (test/config/envoy-gateaway-config/*.yaml), replacing the 20ms default, with an inline comment explaining why.