matchers

package
v0.0.0-...-79e2c14 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareLog

func CompareLog(template interface{}, actual interface{}) (string, bool, error)

func DeepFields

func DeepFields(iface interface{}, namePrefix string) ([]reflect.Value, []string)

func EqualConfigFrom

func EqualConfigFrom(actual interface{}) types.GomegaMatcher

func EqualDiff

func EqualDiff(expect interface{}) types.GomegaMatcher

EqualDiff is like Equal but gives cmp.Diff style output.

func EqualLines

func EqualLines(expected string) types.GomegaMatcher

EqualLines matches multi-line text ignoring blank lines (but not leading/trailing space) On failure gives a diff-style message useful for long strings.

func EqualTrimLines

func EqualTrimLines(expected string) types.GomegaMatcher

EqualTrimLines matches multi-line text ignoring blank lines and leading/trailing space. On failure gives a diff-style message useful for long strings.

func ExpectOK

func ExpectOK(err error, description ...interface{})

ExpectOK is shorthand for these annoyingly long ginkgo forms:

Expect(err).NotTo(HaveOccured()
Expect(err).To(Succeed())

It also does a WrapError to show stderr for *exec.ExitError.

func ExpectOKWithOffset

func ExpectOKWithOffset(skip int, err error, description ...interface{})

func FitLogFormatTemplate

func FitLogFormatTemplate(expected interface{}) types.GomegaMatcher

func HaveCondition

func HaveCondition(t logging.ConditionType, s bool, r logging.ConditionReason, messageRegex string) types.GomegaMatcher

func MatchConditions

func MatchConditions(expected status.Conditions) types.GomegaMatcher

MatchConditions compares 2 conditions slices. For LastTransitionTime, 2 conditions are considered equal either if both timestamps are identical. Or, if expected[..].LastTransitionTime.Time is time 0 UTC, it will check if actual[..].LastTransitionTime has a time stamp within the last 5 minutes.

func MatchLastTransitionTime

func MatchLastTransitionTime(expected metav1.Time) types.GomegaMatcher

Types

type EnvVarMatcher

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

func IncludeEnvVar

func IncludeEnvVar(expected interface{}) *EnvVarMatcher

EqualDiff is like Equal but gives cmp.Diff style output.

func (*EnvVarMatcher) FailureMessage

func (m *EnvVarMatcher) FailureMessage(actual interface{}) (message string)

func (*EnvVarMatcher) Match

func (m *EnvVarMatcher) Match(actual interface{}) (success bool, err error)

func (*EnvVarMatcher) NegatedFailureMessage

func (m *EnvVarMatcher) NegatedFailureMessage(actual interface{}) (message string)

type GeneratorElementMatcher

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

func (*GeneratorElementMatcher) FailureMessage

func (m *GeneratorElementMatcher) FailureMessage(expected interface{}) (message string)

func (*GeneratorElementMatcher) Match

func (m *GeneratorElementMatcher) Match(expected interface{}) (bool, error)

func (*GeneratorElementMatcher) NegatedFailureMessage

func (m *GeneratorElementMatcher) NegatedFailureMessage(expected interface{}) (message string)

type LastTransitionTimeMatcher

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

func (*LastTransitionTimeMatcher) FailureMessage

func (m *LastTransitionTimeMatcher) FailureMessage(actual interface{}) (message string)

func (*LastTransitionTimeMatcher) Match

func (m *LastTransitionTimeMatcher) Match(a interface{}) (success bool, err error)

Match returns success either if both timestamps are identical. If expected.Time is time 0 UTC, it will check if actual.Time has a time stamp within the last 5 minutes.

func (*LastTransitionTimeMatcher) NegatedFailureMessage

func (m *LastTransitionTimeMatcher) NegatedFailureMessage(actual interface{}) (message string)

type LogMatcher

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

func (*LogMatcher) FailureMessage

func (m *LogMatcher) FailureMessage(actual interface{}) (message string)

func (*LogMatcher) Match

func (m *LogMatcher) Match(actual interface{}) (success bool, err error)

func (*LogMatcher) NegatedFailureMessage

func (m *LogMatcher) NegatedFailureMessage(actual interface{}) (message string)

Jump to

Keyboard shortcuts

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