conditions

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package conditions provides a set of conditions which can be used to wait for some condition to be met.

Index

Constants

View Source
const OK = "OK"

OK is returned by the String method of the passed Condition.

Variables

View Source
var ErrSkipAssertion = errors.New("SKIP")

ErrSkipAssertion is used as a return value from AssertionFunc to indicate that this assertion (and, by extension, condition, and check) is to be skipped. It is not returned as an error by any Condition's Wait method but recorded as description and returned by String method.

Functions

This section is empty.

Types

type AssertionFunc

type AssertionFunc func(ctx context.Context) error

AssertionFunc is called every poll interval until it returns nil.

type Condition

type Condition interface {
	fmt.Stringer
	Wait(ctx context.Context) error
}

Condition is a object which Wait()s for some condition to become true.

Condition can describe itself via String() method.

func None

func None() Condition

None is a service condition that has no conditions.

func PollingCondition

func PollingCondition(description string, assertion AssertionFunc, timeout, interval time.Duration) Condition

PollingCondition converts AssertionFunc into Condition by calling it every interval until timeout is reached.

func WaitForAll

func WaitForAll(conditions ...Condition) Condition

WaitForAll creates a condition which waits for all the conditions to be successful.

func WaitForFileToExist

func WaitForFileToExist(filename string) Condition

WaitForFileToExist is a service condition that will wait for the existence of a file.

func WaitForFilesToExist

func WaitForFilesToExist(filenames ...string) Condition

WaitForFilesToExist is a service condition that will wait for the existence of all the files.

func WaitForKubeconfigReady

func WaitForKubeconfigReady(filename string) Condition

WaitForKubeconfigReady is a condition that will wait for the kubeconfig to be ready.

Jump to

Keyboard shortcuts

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