capitest

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDiscoverVariables

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

func ValidateGeneratePatches

func ValidateGeneratePatches[T mutation.GeneratePatches](
	t *testing.T,
	handlerCreator func() T,
	testDefs ...PatchTestDef,
)

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