step

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectsFromPath

func ObjectsFromPath(path, dir string) ([]client.Object, error)

ObjectsFromPath returns an array of runtime.Objects for files / urls provided

Types

type Step

type Step struct {
	Name       string
	Index      int
	SkipDelete bool

	Dir           string
	TestRunLabels labels.Set
	TemplateEnv   template.Env

	Step   *harness.TestStep
	Assert *harness.TestAssert

	Programs map[string]cel.Program

	Asserts []client.Object
	Apply   []client.Object
	Errors  []client.Object

	Timeout int

	Kubeconfig        string
	KubeconfigLoading string
	Context           string

	Client          func(forceNew bool) (client.Client, error)
	DiscoveryClient func() (discovery.DiscoveryInterface, error)

	Logger testutils.Logger
}

A Step contains the name of the test step, its index in the test, and all of the test step's settings (including objects to apply and assert on).

func (*Step) Check

func (s *Step) Check(namespace string, timeout int) []error

Check checks if the resources defined in Asserts and Errors are in the correct state.

func (*Step) CheckAssertCommands

func (s *Step) CheckAssertCommands(ctx context.Context, namespace string, commands []harness.TestAssertCommand, timeout int) []error

CheckAssertCommands Runs the commands provided in `commands` and check if have been run successfully. the errors returned can be a failure of executing the command or the failure of the command executed.

func (*Step) CheckAssertExpressions

func (s *Step) CheckAssertExpressions(namespace string) []error

CheckAssertExpressions validates assertion expressions against the current cluster state.

func (*Step) CheckResource

func (s *Step) CheckResource(expected runtime.Object, namespace string) []error

CheckResource checks if the expected resource's state in Kubernetes is correct.

func (*Step) CheckResourceAbsent

func (s *Step) CheckResourceAbsent(expected runtime.Object, namespace string) error

CheckResourceAbsent checks if the expected resource's state is absent in Kubernetes.

func (*Step) Clean

func (s *Step) Clean(namespace string) error

Clean deletes all resources defined in the Apply list.

func (*Step) Create

func (s *Step) Create(test *testing.T, namespace string) []error

Create applies all resources defined in the Apply list.

func (*Step) DeleteExisting

func (s *Step) DeleteExisting(namespace string) error

DeleteExisting deletes any resources in the TestStep.Delete list prior to running the tests.

func (*Step) GetTimeout

func (s *Step) GetTimeout() int

GetTimeout gets the timeout defined for the test step.

func (*Step) LoadYAML

func (s *Step) LoadYAML(f kfile.Info) error

LoadYAML loads the resources from a YAML file for a test step.

func (*Step) Run

func (s *Step) Run(test *testing.T, namespace string) []error

Run runs a KUTTL test step: 1. Delete objects that should be deleted. Stop if this fails. 2. Run step commands. 3. Apply all desired objects to Kubernetes. 4. Stop if the above fails. 5. Check assertions in a loop until they all pass or step times out. 6. On success, return. 7. On failure, run collector commands, if any.

func (*Step) Setup

func (s *Step) Setup(caseLogger testutils.Logger, defaultClientFunc func(forceNew bool) (client.Client, error), defaultDiscoveryClientFunc func() (discovery.DiscoveryInterface, error))

Setup prepares the step by configuring its logger and client provider methods.

func (*Step) String

func (s *Step) String() string

String implements the string interface, returning the name of the test step.

Jump to

Keyboard shortcuts

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