test

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualFromYamlFile

func EqualFromYamlFile[k8sobject comparable](t *testing.T, expectedYamlFile string, actual client.Object, s runtime.ObjectTyper)

func RunWithTimeout

func RunWithTimeout(f func() error, timeout time.Duration, interval time.Duration) (isTimeout bool, err error)

Types

type TestCase

type TestCase[k8sObject client.Object] struct {
	// Permit to lauch some preaction, like init mock
	PreTest func(stepName *string, data map[string]any) error
	Steps   []TestStep[k8sObject]
	// contains filtered or unexported fields
}

func NewTestCase

func NewTestCase[k8sObject client.Object](t *testing.T, c client.Client, key types.NamespacedName, wait time.Duration, data map[string]any) *TestCase[k8sObject]

func (*TestCase[k8sObject]) Run

func (h *TestCase[k8sObject]) Run()

type TestStep

type TestStep[k8sObject client.Object] struct {
	Name  string
	Pre   func(c client.Client, data map[string]any) error
	Do    func(c client.Client, key types.NamespacedName, o k8sObject, data map[string]any) error
	Check func(t *testing.T, c client.Client, key types.NamespacedName, o k8sObject, data map[string]any) error
}

Jump to

Keyboard shortcuts

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