config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package config contains configuration options for configuring uptest runtime.

Package config contains configuration options for configuring uptest runtime.

Index

Constants

View Source
const (
	// AnnotationKeyTimeout defines a test time for the annotated resource.
	AnnotationKeyTimeout = "uptest.upbound.io/timeout"
	// AnnotationKeyConditions defines the list of status conditions to
	// assert on the tested resource.
	AnnotationKeyConditions = "uptest.upbound.io/conditions"
	// AnnotationKeyPreAssertHook defines the path to a pre-assert
	// hook script to be executed before the resource is tested.
	AnnotationKeyPreAssertHook = "uptest.upbound.io/pre-assert-hook"
	// AnnotationKeyPostAssertHook defines the path to a post-assert
	// hook script to be executed after the resource is tested.
	AnnotationKeyPostAssertHook = "uptest.upbound.io/post-assert-hook"
	// AnnotationKeyPreDeleteHook defines the path to a pre-delete
	// hook script to be executed before the tested resource is deleted.
	AnnotationKeyPreDeleteHook = "uptest.upbound.io/pre-delete-hook"
	// AnnotationKeyPostDeleteHook defines the path to a post-delete
	// hook script to be executed after the tested resource is deleted.
	AnnotationKeyPostDeleteHook = "uptest.upbound.io/post-delete-hook"
	// AnnotationKeyUpdateParameter defines the update parameter that will be
	// used during the update step
	AnnotationKeyUpdateParameter = "uptest.upbound.io/update-parameter"
	// AnnotationKeyExampleID is id of example that populated from example
	// manifest. This information will be used for determining the root resource
	AnnotationKeyExampleID = "meta.upbound.io/example-id"
	// AnnotationKeyDisableImport determines whether the Import
	// step of the resource to be tested will be executed or not.
	AnnotationKeyDisableImport = "uptest.upbound.io/disable-import"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AutomatedTest

type AutomatedTest struct {
	Directory string

	ManifestPaths  []string
	DataSourcePath string

	SetupScriptPath    string
	TeardownScriptPath string

	DefaultTimeout    time.Duration
	DefaultConditions []string

	SkipDelete bool
	SkipUpdate bool
	SkipImport bool

	OnlyCleanUptestResources bool

	RenderOnly            bool
	LogCollectionInterval time.Duration
}

AutomatedTest represents an automated test of resource example manifests to be run with uptest.

type Builder added in v1.3.0

type Builder struct {
	// contains filtered or unexported fields
}

Builder is a struct that helps construct an AutomatedTest instance step-by-step.

func NewBuilder added in v1.3.0

func NewBuilder() *Builder

NewBuilder initializes and returns a new Builder instance.

func (*Builder) Build added in v1.3.0

func (b *Builder) Build() *AutomatedTest

Build finalizes and returns the constructed AutomatedTest instance.

func (*Builder) SetDataSourcePath added in v1.3.0

func (b *Builder) SetDataSourcePath(dataSourcePath string) *Builder

SetDataSourcePath sets the data source path for the AutomatedTest and returns the Builder.

func (*Builder) SetDefaultConditions added in v1.3.0

func (b *Builder) SetDefaultConditions(defaultConditions []string) *Builder

SetDefaultConditions sets the default conditions for the AutomatedTest and returns the Builder.

func (*Builder) SetDefaultTimeout added in v1.3.0

func (b *Builder) SetDefaultTimeout(defaultTimeout time.Duration) *Builder

SetDefaultTimeout sets the default timeout duration for the AutomatedTest and returns the Builder.

func (*Builder) SetDirectory added in v1.3.0

func (b *Builder) SetDirectory(directory string) *Builder

SetDirectory sets the directory path for the AutomatedTest and returns the Builder.

func (*Builder) SetLogCollectionInterval added in v1.3.0

func (b *Builder) SetLogCollectionInterval(logCollectionInterval time.Duration) *Builder

SetLogCollectionInterval sets the interval for log collection during the AutomatedTest and returns the Builder.

func (*Builder) SetManifestPaths added in v1.3.0

func (b *Builder) SetManifestPaths(manifestPaths []string) *Builder

SetManifestPaths sets the paths of the manifest files for the AutomatedTest and returns the Builder.

func (*Builder) SetOnlyCleanUptestResources added in v1.3.0

func (b *Builder) SetOnlyCleanUptestResources(onlyCleanUptestResources bool) *Builder

SetOnlyCleanUptestResources sets whether the AutomatedTest should clean up only test-specific resources and returns the Builder.

func (*Builder) SetRenderOnly added in v1.3.0

func (b *Builder) SetRenderOnly(renderOnly bool) *Builder

SetRenderOnly sets whether the AutomatedTest should only render outputs without execution and returns the Builder.

func (*Builder) SetSetupScriptPath added in v1.3.0

func (b *Builder) SetSetupScriptPath(setupScriptPath string) *Builder

SetSetupScriptPath sets the setup script path for the AutomatedTest and returns the Builder.

func (*Builder) SetSkipDelete added in v1.3.0

func (b *Builder) SetSkipDelete(skipDelete bool) *Builder

SetSkipDelete sets whether the AutomatedTest should skip resource deletion and returns the Builder.

func (*Builder) SetSkipImport added in v1.3.0

func (b *Builder) SetSkipImport(skipImport bool) *Builder

SetSkipImport sets whether the AutomatedTest should skip resource imports and returns the Builder.

func (*Builder) SetSkipUpdate added in v1.3.0

func (b *Builder) SetSkipUpdate(skipUpdate bool) *Builder

SetSkipUpdate sets whether the AutomatedTest should skip resource updates and returns the Builder.

func (*Builder) SetTeardownScriptPath added in v1.3.0

func (b *Builder) SetTeardownScriptPath(teardownScriptPath string) *Builder

SetTeardownScriptPath sets the teardown script path for the AutomatedTest and returns the Builder.

type Manifest

type Manifest struct {
	FilePath string
	Object   *unstructured.Unstructured
	YAML     string
}

Manifest represents a resource loaded from an example resource manifest file.

type Resource

type Resource struct {
	Name       string
	Namespace  string
	KindGroup  string
	YAML       string
	APIVersion string
	Kind       string

	Timeout              time.Duration
	Conditions           []string
	PreAssertScriptPath  string
	PostAssertScriptPath string
	PreDeleteScriptPath  string
	PostDeleteScriptPath string

	UpdateParameter   string
	UpdateAssertKey   string
	UpdateAssertValue string

	SkipImport bool

	Root bool
}

Resource represents a Kubernetes object to be tested and asserted by uptest.

type TestCase

type TestCase struct {
	Timeout            time.Duration
	SetupScriptPath    string
	TeardownScriptPath string
	SkipUpdate         bool
	SkipImport         bool

	OnlyCleanUptestResources bool

	TestDirectory string
}

TestCase represents a test-case to be run by chainsaw.

Jump to

Keyboard shortcuts

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