wait

package
v1.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

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.

func FastWaitConfig

func FastWaitConfig() WaitConfig

FastWaitConfig is for quick operations.

func SlowWaitConfig

func SlowWaitConfig() WaitConfig

SlowWaitConfig is for complex operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL