Skip to content

ROX-36240: fix flaky Severity sort test in violations E2E - #22436

Open
c-du wants to merge 1 commit into
masterfrom
cong/ROX-36240-fix-flaky-severity-sort-test
Open

ROX-36240: fix flaky Severity sort test in violations E2E#22436
c-du wants to merge 1 commit into
masterfrom
cong/ROX-36240-fix-flaky-severity-sort-test

Conversation

@c-du

@c-du c-du commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

The should sort the Severity column test in violations.test.js has been flaking in nightly runs since Aug 10, 2026 (3 failures in 11 days across all three GKE nightly variants).

Root cause: ViolationsTablePage polls the server every 5 seconds via useInterval. 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 by interactAndWaitForViolationsResponses before 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 freeze setInterval. This prevents the poll from firing during the test without affecting any other behavior.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • modified existing tests

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.

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>
@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@c-du
c-du marked this pull request as ready for review August 25, 2026 06:13
@c-du
c-du requested a review from a team as a code owner August 25, 2026 06:13
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b0d1b0e7-da80-499c-b0c0-4a0e7933f6ff

📥 Commits

Reviewing files that changed from the base of the PR and between c87b501 and b44246b.

📒 Files selected for processing (1)
  • ui/apps/platform/cypress/integration/violations/violations.test.js

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Improved violation table test reliability by controlling time during requests, preventing polling-related synchronization issues.

Walkthrough

The 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.

Changes

Violations test stability

Layer / File(s) Summary
Freeze polling clock
ui/apps/platform/cypress/integration/violations/violations.test.js
The severity sorting test freezes Cypress time before page navigation and response waits.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to b4424

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: alanonthegit

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed 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…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the flaky Severity sort test and the fix in the violations E2E suite.
Description check ✅ Passed 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 d…
Full details: Docstring Coverage

Explanation

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 check

Explanation

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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cong/ROX-36240-fix-flaky-severity-sort-test

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.32%. Comparing base (7d6c33b) to head (b44246b).
⚠️ Report is 2 commits behind head on master.

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     
Flag Coverage Δ
go-unit-tests 51.32% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit b44246b. To use with deploy scripts:

export MAIN_IMAGE_TAG=5.0.x-49-gb44246b038

@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

@c-du: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ocp-4-22-ui-e2e-tests b44246b link false /test ocp-4-22-ui-e2e-tests

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@c-du
c-du requested a review from a team August 25, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant