test

package
v0.0.0-...-46d7da7 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eventually

func Eventually(t *testing.T, name string, cond Condition)

Eventually polls cond until it completes (returns true) or times out (resulting in a test failure).

Types

type Condition

type Condition func() bool

A Condition is a function that returns true when a test condition is satisfied.

type EventualOpts

type EventualOpts struct {
	// contains filtered or unexported fields
}

EventualOpts defines a polling strategy for operations that must eventually succeed. A new EventualOpts must be provided for each invocation of Eventually (or call Reset on a previously completed set of options).

func NewEventualOpts

func NewEventualOpts(interval, deadline time.Duration) *EventualOpts

NewEventualOpts constructs an EventualOpts instance with the provided polling interval and deadline. EventualOpts will perform randomized exponential backoff using the starting interval, and will stop polling (and therefore fail) after deadline time as elapsed from calling Eventually.

Note: we always backoff with a randomization of 0.5 (50%), a multiplier of 1.5, and a max interval of one minute.

func (EventualOpts) Eventually

func (e EventualOpts) Eventually(t *testing.T, name string, cond Condition)

Eventually polls cond until it succeeds (returns true) or we exceed the deadline. Eventually performs backoff while polling cond.

name is printed as part of the test failure message when we exceed the deadline to help identify the test case failing. cond does not need to be thread-safe: it is only called from the current goroutine. cond itself can also fail the test early using t.Fatal.

Directories

Path Synopsis
fakes
policy
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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