fake

package
v1.76.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ops

type Ops struct {
	// MaxAttempts configures the maximum amount of attempts before returning a retryError. If it is set to 0, it
	// fails immediately and f is never called.
	MaxAttempts int
}

Ops implements retry.Ops and can be used to mock calls to retry.Until and retry.UntilTimeout in unit tests. This implementation ignores the `interval` parameter and doesn't wait between retries, which makes it useful for writing quick and stable unit tests.

func (*Ops) Until

func (o *Ops) Until(ctx context.Context, _ time.Duration, f retry.Func) error

Until implements retry.Ops without waiting between retries.

func (*Ops) UntilTimeout

func (o *Ops) UntilTimeout(ctx context.Context, interval, _ time.Duration, f retry.Func) error

UntilTimeout implements retry.Ops without waiting between retries. UntilTimeout ignores the timeout parameter and instead uses Ops.MaxAttempts to configure, how often f is retried.

Jump to

Keyboard shortcuts

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