Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

quality.testing

Avoid live network clients in Go unit tests

Unit tests should not dial the real network; prefer fakes or httptest servers.

#Metadata

Rule ID
go.testing.real-network-in-unit-test
Severity
medium
Confidence
0.68
Languages
go
Presets
recommended, strict
Stability
experimental
Applies to
block
Tags
go, rules-catalog, testing

#Why it matters

Live network calls make tests flaky and couple CI to external availability.

#Remediation

Use `httptest`, interface fakes, or recorded fixtures instead of live hosts.

#Repository path

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