gardener: github.com/gardener/gardener/pkg/utils/test Index | Files

package test

import "github.com/gardener/gardener/pkg/utils/test"

Index

Package Files

monitoringcomponent.go test.go

func AlertingRules Uses

func AlertingRules(c component.MonitoringComponent, expectedAlertingRules map[string]string, filenameRulesTest string)

AlertingRules is a utility test function for MonitoringComponents in order to test the alerting rules with the promtool binary.

func WithEnvVar Uses

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 WithVar Uses

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 Uses

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 Uses

func WithWd(path string) func()

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

Package test imports 9 packages (graph). Updated 2020-09-20. Refresh now. Tools for package owners.