Documentation
¶
Overview ¶
Package wait provides polling helpers for tests that cannot import the top-level testutil package due to import cycles with the session package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FastTimeout = 2 * time.Second // For unit tests and quick operations DefaultTimeout = 10 * time.Second // For most integration tests SlowTimeout = 30 * time.Second // For complex operations (file I/O, network) )
Common timeout durations for different test scenarios.
Functions ¶
func WaitForCondition ¶
func WaitForCondition(condition func() bool, config WaitConfig) error
WaitForCondition polls a condition until it returns true or timeout occurs.
func WaitForConditionWithError ¶
func WaitForConditionWithError(condition func() (bool, error), config WaitConfig) error
WaitForConditionWithError polls a condition that can return an error.
Types ¶
type WaitConfig ¶
type WaitConfig struct {
Timeout time.Duration
PollInterval time.Duration
Description string // For better error messages
}
WaitConfig allows customizing wait behaviour.
func DefaultWaitConfig ¶
func DefaultWaitConfig() WaitConfig
DefaultWaitConfig provides sensible defaults.
Click to show internal directories.
Click to hide internal directories.