New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixosTests: Reraise exceptions in subtests so they stop the test #79328
Conversation
140a416
to
555b982
Compare
This basically depends on whether we want to use subtests to describe individual independent things / testcases on machines that don't necessarily depend on each other (A), or just use them as a way to group / give a heading to a bunch of statements (B). The current behaviour (both in python and perl) is to add the an error message to However, I think we mostly do B in many tests, even though we probably shouldn't. WDYT? I don't think we should change semantics here with the perl driver still around. |
It generally makes sense to enable the user to decide which things should make tests fail and which should not.
True, but i observed this behavior to do no good in the many many tests that i have ported.
The vast majority of tests that i have seen assumes behavior B. Behavior B is also a good default setting in my opinion. We could longterm give users some wrapper that is similar to |
I agree that a lot of tests currenly assume B. I'm just hesitant introducing semantic changes with both python and perl driver around, so would really feel better if we pick this up when the perl driver isn't around anymore. |
I agree that it is not cool to have different semantics in different implementations that share the same names. But we have a lot of things in subtests that are necessary prerequisites to their next steps, but won't blow up visibly, leading to tests that time out (e.g. something must be done, but that fails, and then a test loops on Regarding the minority of still existing perl tests that remain untouched and working until they are ported (and people will see that they get more fails instead of less then, which is always better than the other way around), i suggest putting this in. |
Just want to mention if there's any decision on this please merge after branch off. |
Sure.
|
I stumbled more than once into python tests failing in a previous subtests, while I was staring at the later (still running) output. As this doesn't change semantics of passing tests, and as tests run isolated, I don't have any strong objections against this. |
With the tests now bailing out early on a failing subtest, we don't need to keep a list of failed tests, or the number of total tests
555b982
to
3cdd558
Compare
I pushed some cleanups, PTAL. |
@flokli looks good! |
5150378 fixed the long-broken nixosTests.networking.virtual. With all tests failures fixed, and NixOS#79328 making debugging much easier, let's re-add it to the tested jobset.
5150378 fixed the long-broken nixosTests.networking.virtual. With all tests failures fixed, and NixOS#79328 making debugging much easier, let's re-add it to the tested jobset.
Motivation for this change
#72828
While porting the
printing
test i realized that if anassert
triggers within asubtest
, then this is logged but does not lead to test abort. This was bad because without successful assertions the rest of the test didn't make any sense.I changed this passage of the test driver so that it gives extra-info in which subtest the problem occured and then leave it to the global exception handling to fail the whole test.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)