proposal: testing: run tests in parallel by default #73805
Labels
LibraryProposal
Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool
Performance
Proposal
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Proposal Details
#21214 proposed the same but was declined -- mostly because at the time we had no good way of rolling out such a change safely. As this is not the case anymore, and the benefits keep increasing with time (core counts are increasing, codebases and test suites are growing, etc.), I think it would be worth reconsidering it.
The idea would be to make parallel execution the default for modules that specify a go version (not toolchain version) higher than v1.X. Modules with go version below v1.X would still default to serial execution, as today. This would mean that behaviour would not change until a module go version (not toolchain version) is manually updated to v1.X or later.
Individual tests would be given a way to opt-out of parallel execution, similar to how today we allow individual tests to opt-in to parallel execution.
I encourage reviewers to focus on the goal when discussing this proposal, i.e. I welcome alternative ways/solutions to achieve the same goal, and will gladly update the proposal if a better solution is suggested. Some discussion is happening in https://gophers.slack.com/archives/C0VP8EF3R/p1747791714490489.
Proposal
testing.T.Serial()
to allow individual tests to opt out of the new default. Mention that Serial was the default before go v1.X. No-op if the default is serial execution. Panics or fails the test if called afterParallel()
.testing.T.Parallel()
to mention that this is the default starting with go v1.X. No-op if the default is parallel execution. Panics or fails the test if called afterSerial()
.t.Parallel()
calls as unneeded for modules with ago.mod
go version equal or greater than v1.X. Migration assistance tools can be built (possibly even ingo fix
) that would addSerial()
calls to any test that does not have aParallel()
call, and removeParallel()
calls from any test that has it.The text was updated successfully, but these errors were encountered: