Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

quality.testing

Avoid time.Sleep in Go unit tests

Sleeping in _test.go files slows CI and hides synchronization bugs.

#Metadata

Rule ID
go.testing.time-sleep-in-unit-test
Severity
low
Confidence
0.62
Languages
go
Presets
recommended, strict
Stability
experimental
Applies to
block
Tags
go, rules-catalog, testing

#Why it matters

Prefer fake clocks, polling helpers, or integration suites for real delays.

#Remediation

Inject a clock interface, shorten waits, or move the scenario to an integration test harness.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/go/go.testing.time-sleep-in-unit-test.rule.yaml.