componentsuite

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2019 License: Apache-2.0 Imports: 16 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"`

	// Filters selects which patches to apply, based on the
	// annotations on the patches.
	Filters map[string]string `json:"filters"`
}

Apply contains build paramaters

type Build

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

	// Filters selects which patches to apply, based on the
	// annotations on the patches.
	Filters map[string]string `json:"filters"`
}

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.
	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"`

	// 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