helpers

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eventually

func Eventually(t TestingT, condition func() (success bool, reason string), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{})

Eventually asserts that given condition will be met in waitFor time, periodically checking target function each tick. In addition to require.Eventually, this function t.Logs the reason string value returned by the condition function (eventually after 20% of the wait time) to aid in debugging.

func EventuallyCondition

func EventuallyCondition(t TestingT, getter func() (conditions.Getter, error), evaluator *ConditionEvaluator, msgAndArgs ...interface{})

EventuallyCondition asserts that the object returned by getter() eventually has a condition that matches the evaluator.

func EventuallyReady

func EventuallyReady(t TestingT, getter func() (conditions.Getter, error), msgAndArgs ...interface{})

EventuallyReady asserts that the object returned by getter() eventually has a ready condition.

func LoadKubeConfig

func LoadKubeConfig(kubeconfigPath, contextName string) (clientcmd.ClientConfig, error)

LoadKubeConfig loads a kubeconfig from disk. This method is intended to be common between fixture for servers whose lifecycle is test-managed and fixture for servers whose lifecycle is managed separately from a test run.

func RepositoryBinDir

func RepositoryBinDir() (string, error)

RepositoryBinDir returns the absolute path of <repo-dir>/bin. That's where `make build` produces our binaries.

func RepositoryDir

func RepositoryDir() (string, error)

RepositoryDir returns the absolute path of kcp-dev/kcp repository on disk.

func TolerateOrFail added in v0.31.0

func TolerateOrFail(t *testing.T, err error, tolerateErrFuncs ...TolerateErr) bool

TolerateOrFail verifies that the supplied error is not nil, and is tolerated by at least one of the TolerateErr functions. In that case, true is returned. False is returned if the error is nil.

TolerateOrFail fails the test if err is not nil, and none of the TolerateErr functions tolerate the error.

Types

type ConditionEvaluator

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

func IsNot

func (*ConditionEvaluator) WithReason

func (c *ConditionEvaluator) WithReason(reason string) *ConditionEvaluator

type TestingT

type TestingT interface {
	Cleanup(func())
	Errorf(format string, args ...any)
	FailNow()
	Helper()
	Log(args ...any)
	Logf(format string, args ...any)
}

TestingT is implemented by *testing.T and potentially other test frameworks.

type TolerateErr added in v0.31.0

type TolerateErr func(error) bool

TolerateErr returns true if the error is tolerated.

Jump to

Keyboard shortcuts

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