capitest

package
v0.24.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGeneratePatches

func AssertGeneratePatches[T mutation.GeneratePatches](
	t GinkgoTInterface,
	handlerCreator func() T,
	tt *PatchTestDef,
)

func ValidateDiscoverVariables

func ValidateDiscoverVariables[T mutation.DiscoverVariables](
	t *testing.T,
	variableName string,
	variableSchema *clusterv1.VariableSchema,
	variableRequired bool,
	handlerCreator func() T,
	variableTestDefs ...VariableTestDef,
)

func VariableWithValue

func VariableWithValue(
	variableName string,
	value any,
	variablePath ...string,
) runtimehooksv1.Variable

VariableWithValue returns a runtimehooksv1.Variable with the passed name and value.

Types

type JSONPatchMatcher

type JSONPatchMatcher struct {
	Operation    string
	Path         string
	ValueMatcher gomegatypes.GomegaMatcher
}

type PatchTestDef

type PatchTestDef struct {
	Name                  string
	Vars                  []runtimehooksv1.Variable
	RequestItem           runtimehooksv1.GeneratePatchesRequestItem
	ExpectedPatchMatchers []JSONPatchMatcher
	// UnexpectedPatchMatchers used to test patches that should not be present
	UnexpectedPatchMatchers []JSONPatchMatcher
	ExpectedFailure         bool
}

type VariableTestDef

type VariableTestDef struct {
	Name        string
	Vals        any
	ExpectError bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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