crdsvalidation

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestCase

type TestCase[T client.Object] struct {
	// Name is the name of the test case.
	Name string

	// TestObject is the object to be tested.
	TestObject T

	// ExpectedErrorMessage is the expected error message when creating the object.
	ExpectedErrorMessage *string

	// ExpectedUpdateErrorMessage is the expected error message when updating the object.
	ExpectedUpdateErrorMessage *string

	// Update is a function that updates the object in the test case after it's created.
	// It can be used to verify CEL rules that verify the previous object's version against the new one.
	Update func(T)
}

TestCase represents a test case for CRD validation.

func (*TestCase[T]) Run

func (tc *TestCase[T]) Run(t *testing.T)

Run runs the test case.

func (*TestCase[T]) RunWithConfig

func (tc *TestCase[T]) RunWithConfig(t *testing.T, cfg *rest.Config, scheme *runtime.Scheme)

RunWithConfig runs the test case against the provided rest.Config's cluster.

type TestCasesGroup

type TestCasesGroup[T client.Object] []TestCase[T]

TestCasesGroup is a group of test cases related to CRD validation.

func (TestCasesGroup[T]) Run

func (g TestCasesGroup[T]) Run(t *testing.T)

Run runs all test cases in the group.

func (TestCasesGroup[T]) RunWithConfig

func (g TestCasesGroup[T]) RunWithConfig(t *testing.T, cfg *rest.Config, scheme *runtime.Scheme)

RunWithConfig runs all test cases in the group against the provided rest.Config's cluster.

Jump to

Keyboard shortcuts

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