Deflake is a tool that runs tests repeatedly to identify flaky tests.
It integrates with the existing test infrastructure to:
- Run tests with configurable iteration count (-count flag)
- Detect tests that pass inconsistently
- Handle race detector testing (-race flag)
- Skip Example tests (Go runs them exactly once regardless of -count)
- Use isolated TMPDIR per run to prevent /tmp exhaustion
- Clean up old Test* directories from crashed tests
- Set proper timeout hierarchy (go test -timeout > context timeout)
Usage:
go build ./cmd/deflake
./deflake -packages=./... -count=10
./deflake -packages=./tstest/integration -count=20 -race
Change-Id: I4a36314e92197feb8f860a6e2c0b5b0202ce2915
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>