wait

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 3 Imported by: 36

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func For

func For(conditionFunc apimachinerywait.ConditionWithContextFunc, opts ...Option) error

For provides a way to perform poll checks against the kubernetes resource to make sure the resource under test has reached a suitable state before moving to the next action or fail with an error message.

The conditions sub-packages provides a series of pre-defined wait functions that can be used by the developers or a custom wait function can be passed as an argument to get a similar functionality if the check required for your test is not already provided by the helper utility.

Types

type Option

type Option func(*Options)

func WithContext added in v0.3.0

func WithContext(ctx context.Context) Option

WithContext provides a way to configure a context that can be used to cancel the wait condition checks. This will enable end users to write test in cases where the max timeout is not really predictable or is a factor of a different configuration or event.

func WithImmediate

func WithImmediate() Option

WithImmediate configures the way the Wait Checks are invoked. Setting this will invoke the condition check right away before the first wait for the interval kicks in. If not configured, the first check of the condition match will be triggered after the value configured by the WithInterval or defaultPollInterval

func WithInterval

func WithInterval(interval time.Duration) Option

WithInterval configures the interval between the retries to check if a condition has been met while performing the polling wait on a resource under question

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the max timeout that the Wait checks will run trying to see if the resource under question has reached a final expected state. An error will be raised if the resource has not reached the final expected state within the time defined by this configuration

type Options

type Options struct {
	// Interval is used to specify the poll interval while waiting for a condition to be met
	Interval time.Duration
	// Timeout is used to indicate the total time to be spent in polling for the condition
	// to be met.
	Timeout time.Duration
	// StopChan is used to setup a wait mechanism using the apimachinerywait.PollUntil method
	Ctx context.Context
	// Immediate is used to indicate if the apimachinerywait's immediate wait method are to be
	// called instead of the regular one
	Immediate bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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