Feature request: with --fail-fast
, kill other currently running tests
#2482
sourcefrog
started this conversation in
Feature requests
Replies: 1 comment
-
Hey! Yeah I was thinking about this a few weeks ago too. I think this can definitely be an optional mode (as you mentioned, all the implementation logic exists and it just needs to be wired up), though I'm not sure it should be the default -- because it's nice for other tests not to fail if the first one does. In interactive use, yeah, the idea is that if you do want to exit immediately you'll press Ctrl-C. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Motivation
I want nextest to be faster than it is today. In particular, its subprocess execution model is faster than cargo test in some situations, but can be slower when some tests fail.
In particular I'm looking at this because cargo-mutants runs many iterations of different test suites, most of which are expected to fail, and I notice that on at least some trees it's significantly slower than libtest.
Today, when some tests are failing:
cargo test
andlibtest
continue to run all the tests in that target, and then it exits.As a simplified example, suppose we have these tests:
(This is also in https://github.com/sourcefrog/nextest-stragglers)
In this example,
cargo test
finishes on my laptop in 0.063s, andcargo nextest run
takes 10.060s, because it waits for theslow_passes
test to finish. (The difference could be even more extreme if there are integration tests that take more than 10s, which I think is not uncommon or unreasonable.)If this minimization seems unrealistic, imagine a tree which has many sub-100ms unit tests and some >10s integration tests: there's a good chance nextest will wait for at least one integration test to complete, even if a unit tests caught the bug. I think many Rust trees have something like this structure.
Proposal
I'd like an additional option to "kill stragglers" once a test fails. Nextest already seems to have some logic to kill tests that exceed a timeout, so I'd propose to just hook up that code to fire immediately, or after a short timeout, once it decides the suite has failed.
I suspect this mirrors what many humans would do by hitting ctrl-c once nextest says it's cancelling, but it'll make it happen automatically under cargo-mutants, in CI, in background windows, etc.
I realize there might be some cases where test suites leak resources when killed, and so users might not want this, but I think in general sending SIGINT should be reasonable, and it can just be an option.
As a variation we could give stragglers a fraction of a second, or a configurable interval, to finish naturally before trying to kill them.
I think a good precedent for this is the way that Github Actions and other CI systems will terminate other parallel jobs when fail-fast is configured. I think Bazel will also kill jobs with
--test-keep-going=false
.I'd suggest possibly this should be on by default with
--ff
to give the strongest fail-fast behavior.Alternatives
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions