Documentation
¶
Index ¶
- func Eventually(t TestingT, condition func() (success bool, reason string), ...)
- func EventuallyCondition(t TestingT, getter func() (conditions.Getter, error), ...)
- func EventuallyReady(t TestingT, getter func() (conditions.Getter, error), ...)
- func LoadKubeConfig(kubeconfigPath, contextName string) (clientcmd.ClientConfig, error)
- func RepositoryBinDir() (string, error)
- func RepositoryDir() (string, error)
- func TolerateOrFail(t *testing.T, err error, tolerateErrFuncs ...TolerateErr) bool
- type ConditionEvaluator
- type TestingT
- type TolerateErr
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 ¶
RepositoryBinDir returns the absolute path of <repo-dir>/bin. That's where `make build` produces our binaries.
func RepositoryDir ¶
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 Is ¶
func Is(conditionType conditionsv1alpha1.ConditionType) *ConditionEvaluator
func IsNot ¶
func IsNot(conditionType conditionsv1alpha1.ConditionType) *ConditionEvaluator
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
TolerateErr returns true if the error is tolerated.