feat(test): add it.isKnownFlake for opt-in stress-testing flaky Jest fixes#111860
feat(test): add it.isKnownFlake for opt-in stress-testing flaky Jest fixes#111860JoshuaKGoldberg wants to merge 9 commits intomasterfrom
it.isKnownFlake for opt-in stress-testing flaky Jest fixes#111860Conversation
f42d3ea to
59dbb34
Compare
it.knownFlake for stress-testing flaky Jest fixes
59dbb34 to
ac09db1
Compare
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
ac09db1 to
93d1cbe
Compare
5abee83 to
206555a
Compare
Adds infrastructure for validating flaky test fixes in CI: - `itRepeatsWhenFlaky()`: a test wrapper in tests/js/sentry-test/ that runs a test 50x when the RERUN_KNOWN_FLAKY_TESTS env var is set, otherwise runs once as a normal it() - CI wiring: frontend.yml sets RERUN_KNOWN_FLAKY_TESTS=true when the PR has the "Frontend: Rerun Flaky Tests" label - ESLint: configured jest/no-standalone-expect to recognize itRepeatsWhenFlaky as a test block Wraps all 13 known flaky tests (identified from 30 days of CI failures on master) with itRepeatsWhenFlaky so fixes can be stress-tested: - eventReplay/index.spec.tsx (6 occ) - stackTrace.spec.tsx (5 occ) - resultsSearchQueryBuilder.spec.tsx (5 occ, 2 tests) - metricsTab.spec.tsx (4 occ) - customerDetails.spec.tsx (4 occ) - eventsSearchBar.spec.tsx (3 occ) - trace.spec.tsx (3 occ, previously skipped) - allMonitors.spec.tsx (2 occ) - spansSearchBar.spec.tsx (2 occ) - react-native/metrics.spec.tsx (2 occ) - useReplaysFromIssue.spec.tsx (2 occ) - spanEvidencePreview.spec.tsx (2 occ) - groupingInfoSection.spec.tsx (2 occ) Made-with: Cursor
206555a to
6515f63
Compare
it.knownFlake for stress-testing flaky Jest fixesit.knownFlake for opt-in stress-testing flaky Jest fixes
…Flake Mark flaky tests for rerun infrastructure: - TimeSince › respects timezone in tooltip (ENG-7211) - VersionHoverCard › renders (ENG-7212) Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Made-with: Cursor
it.knownFlake for opt-in stress-testing flaky Jest fixesit.isKnownFlake for opt-in stress-testing flaky Jest fixes
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| DEBUG_PRINT_LIMIT: 0 | ||
| # When the "Frontend: Rerun Flaky Tests" label is on the PR, | ||
| # tests wrapped with it.isKnownFlake() run 50x to validate fixes. | ||
| RERUN_KNOWN_FLAKY_TESTS: "${{ contains(github.event.pull_request.labels.*.name, 'Frontend: Rerun Flaky Tests') }}" |
There was a problem hiding this comment.
'Frontend: Rerun Flaky Tests'
Frontend TSC suggested adding a prefix to the label, as we do that a lot for categorized ones. This is not so much a "trigger" (though that could be a nice feature to look into) as a "modifier". Sent: https://github.com/getsentry/getsentry/pull/19741. Once that goes in I'll update here.
Previously, `groupingInfoSection.spec.tsx` was testing the `GroupingInfoSection` component: but all that component does is combine the `InterimSection` component with a lazy-loaded `GroupingInfo` component. That lazy-loading can take >=100-150ms locally, and might be the cause of flake in CI. This PR changes the test to: * Directly test `GroupingInfo`, bypassing the lazy-load * Delete the specific flaky test that was checking for the component being loaded after click (since that's covered by `FoldSection`'s unit tests, as rendered by `InterimSection`) Fixes ENG-7209 ~Note that CI Jest tests are failing because the https://github.com/getsentry/sentry/labels/Frontend%3A%20Rerun%20Flaky%20Tests label is causing _other_, still-flaky tests to be run.~ Rebased on `master` so the `it.isKnownFlake` (#111860) addition isn't here yet. Made with [Cursor](https://cursor.com) Co-authored-by: @nikkikapadia
|
I want to merge this PR, but the frontend / Jest tests keep showing flaky test failures. Which I suppose is good 🙂. In the latest run's failures, https://github.com/getsentry/sentry/actions/runs/23950050162/job/69855165158?pr=111860:
I'll work on getting granular PRs rebased on |

It's hard to determine when a known flaky Jest test is no longer flaky. You basically just have to keep running it repeatedly. But it takes a long time (and bogs up our GHA workflows) to re-run all tests too.
This PR adds plumbing that lets us specifically re-run known flaky tests 50x in a single run:
RERUN_KNOWN_FLAKY_TESTSprocess env varit.isKnownFlakewill define the same test 50x with incremented counter names when that var is presentExample CI failure (search
flaky rerun):I added it to the following tests that have failed >=2x on
masterover the last month:eventReplay/index.spec.tsxstackTrace.spec.tsxresultsSearchQueryBuilder.spec.tsxmetricsTab.spec.tsxcustomerDetails.spec.tsxeventsSearchBar.spec.tsxtrace.spec.tsxit.skip)allMonitors.spec.tsxspansSearchBar.spec.tsxreact-native/metrics.spec.tsxuseReplaysFromIssue.spec.tsxspanEvidencePreview.spec.tsxgroupingInfoSection.spec.tsxtimeSince.spec.tsxversionHoverCard.spec.tsxMade with Cursor