test

package
v1.15.5 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithEnvVar

func WithEnvVar(key, value string) func()

WithEnvVar sets the env variable to the given environment variable and returns a function to revert. If the value is empty, the environment variable will be unset.

func WithFeatureGate added in v1.12.0

func WithFeatureGate(gate featuregate.FeatureGate, f featuregate.Feature, value bool) func()

WithFeatureGate sets the specified gate to the specified value, and returns a function that restores the original value. Failures to set or restore cause the test to fail. Example use:

defer WithFeatureGate(utilfeature.DefaultFeatureGate, features.<FeatureName>, true)()

func WithVar

func WithVar(dst, src interface{}) func()

WithVar sets the given var to the src value and returns a function to revert to the original state. The type of `dst` has to be a settable pointer. The value of `src` has to be assignable to the type of `dst`.

Example usage:

v := "foo"
defer WithVar(&v, "bar")()

func WithVars

func WithVars(dstsAndSrcs ...interface{}) func()

WithVars sets the given vars to the given values and returns a function to revert back. dstsAndSrcs have to appear in pairs of 2, otherwise there will be a runtime panic.

Example usage:

defer WithVars(&v, "foo", &x, "bar")()

func WithWd

func WithWd(path string) func()

WithWd sets the working directory and returns a function to revert to the previous one.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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