live

package
v0.0.0-...-c7d747a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindClusterName   = "live-e2e-test"
	K8sVersionEnvName = "K8S_VERSION"
)

Variables

This section is empty.

Functions

func CheckIfResourceGroupInstalled

func CheckIfResourceGroupInstalled(t *testing.T) bool

func CheckKindClusterAvailable

func CheckKindClusterAvailable(t *testing.T) bool

func CreateKindCluster

func CreateKindCluster(t *testing.T)

func CreateNamespace

func CreateNamespace(t *testing.T, namespace string)

func InstallResourceGroup

func InstallResourceGroup(t *testing.T)

func RemoveKindCluster

func RemoveKindCluster(t *testing.T)

func RemoveNamespace

func RemoveNamespace(t *testing.T, namespace string)

func RemoveResourceGroup

func RemoveResourceGroup(t *testing.T)

Types

type InventoryEntry

type InventoryEntry struct {
	Group     string `yaml:"group,omitempty"`
	Kind      string `yaml:"kind,omitempty"`
	Name      string `yaml:"name,omitempty"`
	Namespace string `yaml:"namespace,omitempty"`
}

InventoryEntry defines an entry in an inventory list.

type Runner

type Runner struct {
	// Config provides the configuration for how this test should be
	// executed.
	Config TestCaseConfig

	// Path provides the path to the test files.
	Path string
}

Runner uses the provided Config to run a test.

func (*Runner) Run

func (r *Runner) Run(t *testing.T)

Run executes the test.

func (*Runner) RunApply

func (r *Runner) RunApply(t *testing.T) (string, string, error)

func (*Runner) RunPreApply

func (r *Runner) RunPreApply(t *testing.T)

func (*Runner) VerifyExitCode

func (r *Runner) VerifyExitCode(t *testing.T, err error)

func (*Runner) VerifyInventory

func (r *Runner) VerifyInventory(t *testing.T, name, namespace string)

func (*Runner) VerifyStderr

func (r *Runner) VerifyStderr(t *testing.T, stderr string)

func (*Runner) VerifyStdout

func (r *Runner) VerifyStdout(t *testing.T, stdout string)

type TestCaseConfig

type TestCaseConfig struct {
	// ExitCode is the expected exit code from the kpt commands. Default: 0
	ExitCode int `yaml:"exitCode,omitempty"`

	// StdErr is the expected standard error output. Default: ""
	StdErr string `yaml:"stdErr,omitempty"`

	// StdOut is the expected standard output from running the command.
	// Default: ""
	StdOut string `yaml:"stdOut,omitempty"`

	// OptionalStdOut is a list of lines that are optional in the standard
	// output from running the command.
	// Default: nil
	OptionalStdOut []string `yaml:"optionalStdOut,omitempty"`

	// Inventory is the expected list of resource present in the inventory.
	Inventory []InventoryEntry `yaml:"inventory,omitempty"`

	// NoResourceGroup defines whether the RG CRD should be present in the cluster
	// when the test starts.
	NoResourceGroup bool `yaml:"noResourceGroup,omitempty"`

	// Parallel defines whether the test can be run in parallel with other
	// tests. The primary requirement here is that the test doesn't create,
	// update, or delete any cluster-scoped resources.
	Parallel bool `yaml:"parallel,omitempty"`

	// KptArgs is a list of args that will be provided to the kpt command
	// when running the test.
	KptArgs []string `yaml:"kptArgs,omitempty"`
}

func ReadTestCaseConfig

func ReadTestCaseConfig(t *testing.T, path string) TestCaseConfig

Jump to

Keyboard shortcuts

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