Documentation
¶
Overview ¶
Package testwait bounds test-side waits for asynchronous effects.
A hang guard proves that an effect eventually happens. Its timeout exists only so a genuine hang fails with a named message instead of the binary's -timeout panic, so it must never encode how fast the effect is. Short real-time guards turn scheduler latency on loaded runners (race detector, hosted Windows, CPU contention) into test failures; every guard here waits up to Budget instead.
Product time bounds ("shutdown finishes within 1s") belong in testing/synctest or an inner deadline assertion, never here. Do not call these helpers inside a synctest bubble: the bubble's fake clock would expire the guard as soon as every goroutine is durably blocked. Call them only from the test goroutine, as t.Fatal requires.
Index ¶
Constants ¶
const MaxBudget = 2 * time.Minute
MaxBudget caps one guard so a hung test still names its wait well before the go test default 10-minute -timeout.
Variables ¶
This section is empty.
Functions ¶
func Budget ¶
Budget returns how long one hang guard may wait: MaxBudget, shortened so the guard expires at least reserve before the test binary's deadline. Once less than reserve+minBudget remains, the budget floors at minBudget, so the reserve is best effort and guards in the binary's last 30 seconds are short.
Types ¶
This section is empty.