The flakestress command stress-tests Go packages to find flaky tests.
It compiles a test binary once and then runs it many times in parallel,
reporting failures. It is similar to golang.org/x/tools/cmd/stress but
with some usability niceties.
go install github.com/bradfitz/flakestress@latest
flakestress [flags] <target>
The target can be:
github.com/foo/bar # test the whole package
github.com/foo/bar.TestBlah # test only TestBlah
github.com/foo/bar.TestBlah/sub # test only a subtest
TestBlah # git grep to find the package
TestBlah/sub # git grep, with subtest
If a bare test name is ambiguous (found in multiple packages), flakestress errors and lists the fully qualified options.
By default it runs NumCPU*2 parallel workers for 1 minute with -failfast
mode enabled. Each worker buffers its output and only failure output is
printed, serialized to avoid interleaving.
-p N number of parallel workers (default NumCPU*2)
-duration d how long to run (default 1m)
-failfast stop on first failure (default true)
-quiet suppress periodic status updates