Documentation
¶
Index ¶
- type Case
- type CaseOption
- func WithClients(getClientFunc getClientFuncType, ...) CaseOption
- func WithIgnoreFiles(patterns []string) CaseOption
- func WithLogSuppressions(suppressions []string) CaseOption
- func WithNamespace(ns string) CaseOption
- func WithRunLabels(runLabels labels.Set) CaseOption
- func WithSkipDelete(skip bool) CaseOption
- func WithTemplateVars(vars map[string]any) CaseOption
- func WithTimeout(timeout int) CaseOption
- type T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Case ¶
type Case struct {
// contains filtered or unexported fields
}
Case contains all the test steps and the Kubernetes client and other global configuration for a test. It represents a leaf directory containing test step files. Case lifecycle:
- gets created (directly by Harness.LoadTests()) before the test's dedicated testing.T comes to file. At this point the namespace name is determined. The following steps are in the scope of the testing.T:
- has .SetLogger() called to assign a logger
- has .LoadTestSteps() called
- has .Run() called, which: 4a. calls setup(), which: prepares the clients unless lazy-loaded, and creates their namespaces if needed (and in this case also schedules namespace deletion for test cleanup time) 4b. for each step: sets the step up, prepares its client if lazy-loaded, and runs the step
func NewCase ¶
func NewCase(name string, parentPath string, options ...CaseOption) *Case
NewCase returns a new test case object.
func (*Case) LoadTestSteps ¶
LoadTestSteps loads all the test steps for a test case.
type CaseOption ¶
type CaseOption func(*Case)
CaseOption represents a functional option for configuring a Case.
func WithClients ¶
func WithClients(getClientFunc getClientFuncType, getDiscoveryClientFunc getDiscoveryClientFuncType) CaseOption
WithClients sets both the client and discovery client functions.
func WithIgnoreFiles ¶ added in v0.24.0
func WithIgnoreFiles(patterns []string) CaseOption
WithIgnoreFiles sets the list of file patterns to ignore.
func WithLogSuppressions ¶
func WithLogSuppressions(suppressions []string) CaseOption
WithLogSuppressions sets the list of log types to suppress.
func WithNamespace ¶
func WithNamespace(ns string) CaseOption
WithNamespace sets the preferred namespace. If empty or not specified, a random namespace name will be generated.
func WithRunLabels ¶
func WithRunLabels(runLabels labels.Set) CaseOption
WithRunLabels sets the run labels.
func WithSkipDelete ¶
func WithSkipDelete(skip bool) CaseOption
WithSkipDelete sets whether to skip deletion of resources.
func WithTemplateVars ¶
func WithTemplateVars(vars map[string]any) CaseOption
func WithTimeout ¶
func WithTimeout(timeout int) CaseOption
WithTimeout sets the timeout in seconds.