Open bcmills opened 11 months ago
This is really unfortunate. testing.T.Run
claims: “Run may be called simultaneously from multiple goroutines, but all such calls must return before the outer test function for t returns.”
The alternate sequential and parallel
test cases seem to encode an assumption that a test should not be considered “running in parallel” while it is blocked on a call to t.Run
— but, of course, determining whether a call to t.Run
in a goroutine blocks its parent from continuing to run is itself quite difficult.
Go version
playground
What operating system and processor architecture are you using (
go env
)?N/A
What did you do?
https://go.dev/play/p/wKFVA6gmUV9?v=gotip
What did you expect to see?
The total number of running test functions that have called
t.Parallel()
should not exceed the limit given by the-test.parallel
flag.What did you see instead?
In addition, if I modify
testing.testContext.release
to panic if therunning
count goes negative, the above test triggers that panic.