componentsuite

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package componentsuite provides a test-suite helper for running component tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, testSuiteFile string)

Run runs a component-tester test-suite. testSuiteFile specifies the path to the a component-test-suite YAML file.

By default, go runs tests with the cwd being the current directory.

Types

type Apply

type Apply struct {
	// Options for apply process
	Options options.JSONOptions `json:"options"`
}

Apply contains build paramaters

type Build

type Build struct {
	// Options for the PatchTemplate build process
	Options options.JSONOptions `json:"options"`
}

Build contains build parameters

type ComponentTestSuite

type ComponentTestSuite struct {
	// ComponentFile contains a path to a component file or component builder
	// file.
	ComponentFile string `json:"componentFile"`

	// RootDirectory is the path to a root-directory to run the tests. If not
	// specified, sets the root directory to the test-suite file directory.
	RootDirectory string `json:"rootDirectory"`

	// TestCases contains a list of component TestCases.
	TestCases []*TestCase `json:"testCases"`
}

ComponentTestSuite contains metadata and test cases for running tests.

type Expect

type Expect struct {
	// Objects contains expectations for objects.
	Objects []ObjectCheck `json:"objects"`

	// CanKubeDeserialize ensures that all objects can be deserialized as
	// concrete Kubernetes objects, using the built in schema.
	CanKubeDeserialize bool `json:"CanKubeDeserialize"`

	// BuildErrSubstr indicates a substring that's expected to be in an error in
	// the build-process.
	BuildErrSubstr string `json:"buildErrSubstr"`

	// ApplyErrSubstr indicates a substring that's expected to be in an error in
	// the apply-process.
	ApplyErrSubstr string `json:"applyErrSubstr"`
}

Expect contains expectations that should be filled.

type ObjectCheck

type ObjectCheck struct {
	// Kind of the object (required).
	Kind string `json:"kind"`

	// Name of the object (required).
	Name string `json:"name"`

	// FindSubstrs contains a list of substrings that are expected to be found in
	// the object after the apply-phase.
	FindSubstrs []string `json:"findSubstrs"`

	// NotFindSubstrs contains a list of substrings that are not expecetd to be
	// found in the object after the apply-phase.
	NotFindSubstrs []string `json:"notFindSubstrs"`
}

ObjectCheck contains checks for a specific Object. Kind, and Name are used to find objects. Expects exactly one object to match.

type TestCase

type TestCase struct {
	// Description of the test.
	Description string `json:"description"`

	// Build contains parameters for the build-phase. This is roughly equivalent
	// to 'bundlectl build'
	Build Build `json:"build"`

	// Apply contains parameters for the apply-phase. This is roughly equivalent
	// to 'bundlectl apply'
	Apply Apply `json:"apply"`

	// Expect contains expectations to check against.
	Expect Expect `json:"expect"`
}

TestCase contains the schema expected for the test-cases.

Jump to

Keyboard shortcuts

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