istio: istio.io/istio/pkg/test Index | Files | Directories

package test

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

Index

Package Files

eventually.go failer.go

func Eventually Uses

func Eventually(t Failer, name string, cond Condition)

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

func Wrap Uses

func Wrap(f func(t Failer)) error

Wrap executes a function with a fake Failer, and returns an error if the test failed. This allows calling functions that take a Failer and using them with functions that expect an error, or allowing calling functions that would cause a test to immediately fail to instead return an error. Wrap handles Cleanup() and short-circuiting of Fatal() just like the real testing.T.

type Condition Uses

type Condition func() bool

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

type EventualOpts Uses

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 Uses

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 Uses

func (e EventualOpts) Eventually(t Failer, 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.

type Failer Uses

type Failer interface {
    Fail()
    FailNow()
    Fatal(args ...interface{})
    Fatalf(format string, args ...interface{})
    Helper()
    Cleanup(func())
}

Failer is an interface to be provided to test functions of the form XXXOrFail. This is a substitute for testing.TB, which cannot be implemented outside of the testing package.

Directories

PathSynopsis
cert
cert/ca
configPackage test is a generated protocol buffer package.
echo/client
echo/common
echo/common/response
echo/common/scheme
echo/proto
echo/server
echo/server/endpoint
echo/server/forwarder
env
envoy
fakes/gce_metadata_server
framework
framework/components/bookinfo
framework/components/echo
framework/components/echo/common
framework/components/echo/echoboot
framework/components/echo/kube
framework/components/environment/kube
framework/components/gcemetadataPackage gcemetadata provides basic utilities around configuring the fake GCE Metadata Server component for integration testing.
framework/components/istio
framework/components/istioctl
framework/components/istio/ingress
framework/components/namespace
framework/components/opentelemetry
framework/components/prometheus
framework/components/redis
framework/components/stackdriver
framework/components/stackdriver/edges
framework/components/telemetry
framework/components/zipkin
framework/errors
framework/features
framework/image
framework/integration
framework/label
framework/resource
framework/tools/featuresgen
framework/tools/featuresgen/cmd
helm
kube
scopes
shell
util/file
util/reserveport
util/retry
util/structpath
util/tmpl
util/yml

Package test imports 7 packages (graph) and is imported by 53 packages. Updated 2021-01-16. Refresh now. Tools for package owners.