Documentation
¶
Index ¶
- func ObjectsFromPath(path, dir string) ([]client.Object, error)
- type Step
- func (s *Step) Check(namespace string, timeout int) []error
- func (s *Step) CheckAssertCommands(ctx context.Context, namespace string, commands []harness.TestAssertCommand, ...) []error
- func (s *Step) CheckAssertExpressions(namespace string) []error
- func (s *Step) CheckResource(expected runtime.Object, namespace string) []error
- func (s *Step) CheckResourceAbsent(expected runtime.Object, namespace string) error
- func (s *Step) Clean(namespace string) error
- func (s *Step) Create(test *testing.T, namespace string) []error
- func (s *Step) DeleteExisting(namespace string) error
- func (s *Step) GetTimeout() int
- func (s *Step) LoadYAML(f kfile.Info) error
- func (s *Step) Run(test *testing.T, namespace string) []error
- func (s *Step) Setup(caseLogger testutils.Logger, ...)
- func (s *Step) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
CheckAssertExpressions validates assertion expressions against the current cluster state.
func (*Step) CheckResource ¶
CheckResource checks if the expected resource's state in Kubernetes is correct.
func (*Step) CheckResourceAbsent ¶
CheckResourceAbsent checks if the expected resource's state is absent in Kubernetes.
func (*Step) DeleteExisting ¶
DeleteExisting deletes any resources in the TestStep.Delete list prior to running the tests.
func (*Step) GetTimeout ¶
GetTimeout gets the timeout defined for the test step.
func (*Step) Run ¶
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.