Build deterministic race-condition tests - identify shared mutable state, drive interleavings via barriers / latches / manual scheduling; use ThreadSanitizer (clang `-fsanitize=thread`) for C/C++ data race detection; run the Go race detector end-to-end (`go test -race`, GORACE tuning, `-count`/`-cpu` stress, goroutine-leak gating with go.uber.org/goleak - references/go.md); use jcstress (`@JCStressTest` + `@Actor` + `@Outcome`) for JVM stress; use Loom virtual-thread interleavings for parallel testing. Use when a defect only reproduces under load on shared in-process state (cache, counter, connection pool, lazy-init singleton), when writing the regression test for a race-condition incident before the fix lands, or when adding `-race` to a Go CI matrix.
73
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Filter options for goleak.VerifyNone / goleak.VerifyTestMain, per
pkg.go.dev/go.uber.org/goleak. Pass one or more as trailing arguments to
suppress goroutines that are expected rather than leaked.
Ignores any goroutine whose top-of-stack frame is the named function. Prefer this when the library goroutine is identifiable by name.
goleak.VerifyNone(t,
goleak.IgnoreTopFunction("database/sql.(*DB).connectionOpener"),
)Ignores any goroutine whose stack contains the named function at any depth, not just the top frame. Use when the identifying frame is not at the top.
goleak.VerifyNone(t,
goleak.IgnoreAnyFunction("google.golang.org/grpc.(*ccBalancerWrapper).watcher"),
)Snapshots the goroutines already running at call time and ignores exactly those at verification.
opt := goleak.IgnoreCurrent()
// ... test logic ...
goleak.VerifyNone(t, opt)Prefer IgnoreTopFunction over IgnoreCurrent when the library goroutine
is identifiable by name: IgnoreCurrent silences goroutines that were
already running at snapshot time, which can mask leaks introduced before
the snapshot.
goleak.Cleanup(func(int)) registers a function goleak calls with the exit
code after the leak check, e.g. to log instead of failing the process. Used
with VerifyTestMain when the default exit behavior needs to change.
IgnoreTopFunction,
IgnoreAnyFunction, IgnoreCurrent, Cleanup