test: run unittests in parallel#8780
Merged
Merged
Conversation
We have been using `go test -p=1` to avoid conflicts between unittests in different packages that both modify the database. However, this significantly slows down running tests. Since it's really on the the sa and ra packages that conflict, and some logic to just handle those. On my machine, this takes us from 56s to 20s (no race detection). When race detection is enabled, the difference is even more dramatic, because each package's test runner sleeps for a second before exiting. On my machine, 70s becomes 30s.
ezekiel
approved these changes
Jun 5, 2026
Contributor
Author
|
Test-only, merging on one review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have been using
go test -p=1to avoid conflicts between unittests in different packages that both modify the database. However, this significantly slows down running tests.Since it's really on the the sa and ra packages that conflict, and some logic to just handle those.
Also, the race detector sleeps for 1s before a process exits. Since each package's test are run as a single process, this costs us a second per package. Lower that to 50ms.
In CI, this takes us from 7m25s for the unittest job to 4m19s.