Open bcmills opened 1 year ago
Change https://go.dev/cl/506755 mentions this issue: testing: simplify concurrency and cleanup
Reopening because the fix was reverted (#64402).
The CL originally submitted for this (which was later reverted) also fixes #49929
When run with
-failfast
, the following test should run onlyTest1
, which fails. Instead, it reports the failure fromTest1
and then proceeds to runTest2
.https://go.dev/play/p/OiVQBuQ7fJl:
Without the call to
t.Parallel()
, it skipsTest2
as expected.This is because the
numFailed
variable used for-failfast
is incremented before cleanup, only for tests that have parallel subtests.I do not see a compelling reason for the difference in codepaths between tests with parallel subtests and those without. But I also don't see why we need to keep track of the number of failed tests explicitly — it seems like we could instead just set a boolean when any test fails.