Documentation ¶
Overview ¶
Package wait provides constructs for waiting on conditionals within specified constraints.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
type Constraint struct {
// contains filtered or unexported fields
}
A Constraint is something a test assertions can wait on before marking the result to be a failure. A Constraint that uses Timeout will retry a function until the timeout expires. A Constraint that uses Attempts will retry a function until the number of attempts is exhausted. The interval between retry attempts can be configured with Gap.
func On ¶
func On(opts ...Option) *Constraint
On creates a new Constraint with configuration set by opts.
Timeout is used to set a maximum amount of time to wait for success. Attempts is used to set a maximum number of attempts to wait for success. Gap is used to control the amount of time to wait between retries.
func (*Constraint) Run ¶
func (c *Constraint) Run() error
Run the Constraint and produce an error result.
type Option ¶
type Option func(*Constraint)
Option is used to configure a Constraint.
func Attempts ¶
Attempts sets the maximum number of attempts to allow before giving up and marking the result as a failure.
If set, the timeout constraint is disabled.
By default a max timeout is used and the number of attempts is unlimited.
func BoolFunc ¶
BoolFunc will retry f while it returns false, or until a wait constraint threshold is exceeded.
func ErrorFunc ¶
ErrorFunc will retry f while it returns a non-nil error, or until a wait constraint threshold is exceeded.