istio: istio.io/istio/pkg/test/util/retry Index | Files

package retry

import "istio.io/istio/pkg/test/util/retry"

Index

Package Files

retry.go

Constants

const (
    // DefaultTimeout the default timeout for the entire retry operation
    DefaultTimeout = time.Second * 30

    // DefaultDelay the default delay between successive retry attempts
    DefaultDelay = time.Millisecond * 10

    // DefaultConverge the default converge, requiring something to succeed one time
    DefaultConverge = 1
)

func Do Uses

func Do(fn RetriableFunc, options ...Option) (interface{}, error)

Do retries the given function, until there is a timeout, or until the function indicates that it has completed.

func UntilSuccess Uses

func UntilSuccess(fn func() error, options ...Option) error

UntilSuccess retries the given function until success, timeout, or until the passed-in function returns nil.

func UntilSuccessOrFail Uses

func UntilSuccessOrFail(t test.Failer, fn func() error, options ...Option)

UntilSuccessOrFail calls UntilSuccess, and fails t with Fatalf if it ends up returning an error

type Option Uses

type Option func(cfg *config)

Option for a retry opteration.

func Converge Uses

func Converge(successes int) Option

Converge sets the number of successes in a row needed to count a success. This is useful to avoid the case where tests like `coin.Flip() == HEADS` will always return success due to random variance.

func Delay Uses

func Delay(delay time.Duration) Option

Delay sets the delay between successive retry attempts.

func Timeout Uses

func Timeout(timeout time.Duration) Option

Timeout sets the timeout for the entire retry operation.

type RetriableFunc Uses

type RetriableFunc func() (result interface{}, completed bool, err error)

RetriableFunc a function that can be retried.

Package retry imports 3 packages (graph) and is imported by 37 packages. Updated 2020-03-18. Refresh now. Tools for package owners.