ROX-36240: fix flaky Severity sort test in violations E2E - #22436
Conversation
The test races against ViolationsTablePage's 5-second polling interval. When the poll fires between the cy.intercept setup and cy.wait, the wait resolves against the poll response (time-sorted data) instead of the user-triggered sort response, causing the severity order assertion to fail. Fix: add cy.clock() at the top of the test to freeze setInterval, matching the pattern already used in networkGraph and Clusters helpers. Partially generated by AI (Claude Sonnet 4.6). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Severity-column Cypress test now freezes the clock before loading the Violations page and waiting for responses. This prevents the table’s 5-second polling from racing with response synchronization. ChangesViolations test stability
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This is a localized test-only change that freezes polling during the affected sort test, preventing the known timing race without changing product behavior. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. Full details: Description checkExplanation The description is complete and relevant. It explains the failure, root cause, timing, fix, documentation status, testing scope, and validation. The CI inspection checkbox remains unchecked, but the description is otherwise sufficient. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #22436 +/- ##
==========================================
- Coverage 51.33% 51.32% -0.02%
==========================================
Files 2863 2863
Lines 179461 179461
==========================================
- Hits 92134 92113 -21
- Misses 79232 79241 +9
- Partials 8095 8107 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🚀 Build Images ReadyImages are ready for commit b44246b. To use with deploy scripts: export MAIN_IMAGE_TAG=5.0.x-49-gb44246b038 |
|
@c-du: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Description
The
should sort the Severity columntest inviolations.test.jshas been flaking in nightly runs since Aug 10, 2026 (3 failures in 11 days across all three GKE nightly variants).Root cause:
ViolationsTablePagepolls the server every 5 seconds viauseInterval. When the test reaches the sort-column click at ~T=4s, the poll fires at T=5s and its response — sorted by Violation Time, not Severity — is intercepted byinteractAndWaitForViolationsResponsesbefore the sort-click response arrives. The assertion then runs on time-sorted data and fails.Why it started Aug 10: Two file access violation UI changes (ROX-35545, ROX-35546) merged Aug 4–5 added slightly more content to the violations page, pushing the test elapsed time into the window where the 5s poll races with the sort interaction. The race condition existed since polling was introduced in 2021, but the timing was benign until the page got heavier.
Fix: Add
cy.clock()at the start of the test to freezesetInterval. This prevents the poll from firing during the test without affecting any other behavior.User-facing documentation
Testing and quality
Automated testing
How I validated my change
Test-only change (single
cy.clock()call). Validation via CI nightly runs — the fix eliminates the poll entirely during the test, making the race mechanically impossible.