testutils

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package testutils provides common test utilities for config manager testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertConfigManagerCaches

func AssertConfigManagerCaches[T any](
	t *testing.T,
	fileName string,
	configContent string,
	newManager func(configPath string) configmanager.ConfigManager[T],
)

AssertConfigManagerCaches verifies that a config manager reuses a previously loaded configuration when the underlying file becomes invalid after the initial load.

func RunConfigManagerTests

func RunConfigManagerTests[T any](
	t *testing.T,
	newManager func(configPath string) configmanager.ConfigManager[T],
	scenarios []TestScenario[T],
)

RunConfigManagerTests runs a comprehensive test suite for config managers.

Types

type TestScenario

type TestScenario[T any] struct {
	Name                string
	ConfigContent       string
	APIVersion          string
	Kind                string
	ExpectedName        string
	ShouldError         bool
	ValidationFunc      func(t *testing.T, config *T)
	SetupFunc           func(t *testing.T) string // Returns config path
	UseCustomConfigPath bool
}

TestScenario represents a test scenario for config managers.

Jump to

Keyboard shortcuts

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