Skip to content

test: fix flaky RouteStatNameTest and refactor#8368

Merged
arkodg merged 5 commits intoenvoyproxy:mainfrom
Arpit529Srivastava:issue-8110
Mar 7, 2026
Merged

test: fix flaky RouteStatNameTest and refactor#8368
arkodg merged 5 commits intoenvoyproxy:mainfrom
Arpit529Srivastava:issue-8110

Conversation

@Arpit529Srivastava
Copy link
Copy Markdown
Contributor

@Arpit529Srivastava Arpit529Srivastava commented Feb 27, 2026

What type of PR is this?

fix flaky e2e tests

What this PR does / why we need it:
httproutestatnametest/prometheus and tcproutestatnametest/prometheus were flaky because they sent traffic immediately after the gateway and route were accepted, without waiting for the backendtrafficpolicy (which configures routestatname) to be accepted and propagated to envoy via xds.

this introduced a race condition where traffic could reach envoy before the custom stat name was configured, so the expected prometheus metric label was never emitted and the 1-minute poll failed with context deadline exceeded.

the fix adds a backendtrafficpolicymustbeaccepted check in both tests before sending traffic, ensuring the policy is fully reconciled and pushed to envoy first. this follows the same pattern already used by other tests in this package.

this pr also adopts the refactoring from #8350 by merging both tests into a single routestatnametest with t.run("httproute") and t.run("tcproute") subtests.
Which issue(s) this PR fixes:

Fixes #8110

Release Notes: Yes/No
No

@Arpit529Srivastava Arpit529Srivastava requested a review from a team as a code owner February 27, 2026 19:27
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 27, 2026

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 80f9f0e
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69aa06f085124d0008e86cf3
😎 Deploy Preview https://deploy-preview-8368--cerulean-figolla-1f9435.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.

@Arpit529Srivastava
Copy link
Copy Markdown
Contributor Author

@zhaohuabing Ptal, thanks :)

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.20%. Comparing base (cd89ca5) to head (80f9f0e).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8368      +/-   ##
==========================================
- Coverage   74.23%   74.20%   -0.04%     
==========================================
  Files         242      242              
  Lines       37335    37335              
==========================================
- Hits        27717    27703      -14     
- Misses       7685     7696      +11     
- Partials     1933     1936       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Arpit529Srivastava
Copy link
Copy Markdown
Contributor Author

again flaky #7484 ?
/cc : @zhaohuabing

@github-actions github-actions Bot requested a review from zhaohuabing February 27, 2026 21:01
@zirain
Copy link
Copy Markdown
Member

zirain commented Feb 28, 2026

@Arpit529Srivastava can you adpot #8350 into your PR?

@Arpit529Srivastava Arpit529Srivastava changed the title test: fix flaky HTTPRouteStatNameTest and TCPRouteStatNameTest test: fix flaky RouteStatNameTest and refactor Feb 28, 2026
@Arpit529Srivastava
Copy link
Copy Markdown
Contributor Author

@Arpit529Srivastava can you adpot #8350 into your PR?

made the requested changes please take a look, thanks :)

@Arpit529Srivastava
Copy link
Copy Markdown
Contributor Author

/cc @zirain

@github-actions github-actions Bot requested a review from zirain February 28, 2026 09:51
Signed-off-by: arpit529srivastava <arpitsrivastava529@gmail.com>
Signed-off-by: arpit529srivastava <arpitsrivastava529@gmail.com>
@zirain
Copy link
Copy Markdown
Member

zirain commented Feb 28, 2026

wait #8370

@zirain
Copy link
Copy Markdown
Member

zirain commented Mar 1, 2026

Signed-off-by: arpit529srivastava <arpitsrivastava529@gmail.com>
@Arpit529Srivastava
Copy link
Copy Markdown
Contributor Author

Arpit529Srivastava commented Mar 5, 2026

@zirain i don’t think this failure is related to my changes. this pr only touches stat_name.go and its testdata.

the HeaderBasedConsistentHashLoadBalancing test is known to be flaky (see #8349), so this looks like the same issue. could we try re-running the ci?

Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — thanks for helping fix the flake!

@zhaohuabing zhaohuabing requested a review from a team March 6, 2026 03:19
@zirain
Copy link
Copy Markdown
Member

zirain commented Mar 6, 2026

/retest

@Arpit529Srivastava
Copy link
Copy Markdown
Contributor Author

@zhaohuabing @zirain ig we are good to merge?

@arkodg arkodg merged commit 2bc4a18 into envoyproxy:main Mar 7, 2026
72 of 80 checks passed
@Arpit529Srivastava Arpit529Srivastava deleted the issue-8110 branch March 7, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestE2E/HTTPRouteStatNameTest/prometheus is flaky

4 participants