ci: retry flaky tests#9508
ci: retry flaky tests#9508tony19 wants to merge 6 commits intovitejs:mainfrom tony19:fix/retry-flaky-tests-in-ci
Conversation
related #9492
patak-cat
left a comment
There was a problem hiding this comment.
Looks great @tony19! I think this is a good idea, at least for the node segfault we can't use something from Vitest side (even if there is a retry mechanism). @antfu @sheremet-va looping you to see if this is a good approach (at least for the moment) for the Vite repo, as I think other projects may end up copying what we do here.
@dominikg maybe we should do the same on Vite ecosystem CI?
not a fan of a bash script wrapper in general
other remarks
|
|
@dominikg Thanks for the feedback! I did actually experiment with a Node/ I also agree with pushing for an upstream fix, but it doesn't look like the Node team is anywhere close to a fix, and they're not sure the fix is even feasible:
For the time being, an automated retry seems like a reasonable workaround to keep the bots going without babysitting them. I'm completely open to other ideas though! Update: Fix for Node 16 identified here |
|
Looks great! A side note, I guess it might be good to create a CLI wrapper like |
Sure, something like |
|
Yeah |
|
@antfu @sheremet-va Yes, please! 😄 A native |
|
A flag on vitest bin makes it reusable which is great! Not sure how i feel about it being enabled by default, tbh i havn't seen this segfault happening in vite-plugin-svelte suite (which is a bit smaller but uses the same setup as vite). It should be something users conciously opt-in to, so as they are aware of it. If it is enabled and can detect github action event to log the warning card, that would be awesome. |
|
https://github.com/vitest-dev/vitest/releases/tag/v0.22.0 Shipped in Vitest v0.22.0. Could enable via a env: https://github.com/vitest-dev/vitest/blob/8f24c2f65e436aa98a9e1c77eddf5d082c2ca60d/.github/workflows/ci.yml#L12-L13 |
|
Node published a v16 fix in |
related #9492
Description
This updates the CI test jobs to use
retry.ts, which reruns the given command (up to 3 times by default) if its output contains one of the errors indicated in #9492. I picked 3 for the default retry count because in my experiments, the same error can appear twice in a row.The script also adds a warning annotation to the GitHub workflow run to easily identify the flakiness from the Summary view:
This script can be run locally like this:
Testing
retry.tsHere's a script that runs
pnpm --color=always test-build10 times in a row, which causes one of the known errors in Node 16:(Tested on macOS Big Sur with Node 16.16.0)
Screenshot:
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).