testrunner

package
v1.9.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToUnstructured added in v0.8.0

func ConvertToUnstructured(data []byte) (*unstructured.Unstructured, error)

ConvertToUnstructured converts a resource to unstructured format

func LoadFile

func LoadFile(path string) ([]byte, error)

LoadFile loads file in byte buffer

func RootDir added in v1.5.0

func RootDir() string

RootDir returns the kyverno project directory based on the location of the current file. It assumes that the project directory is 2 levels up. This means if this function is moved it may not work as expected.

Types

type Expected added in v1.5.0

type Expected struct {
	Mutation   Mutation   `yaml:"mutation,omitempty"`
	Validation Validation `yaml:"validation,omitempty"`
	Generation Generation `yaml:"generation,omitempty"`
}

type Generation added in v1.5.0

type Generation struct {
	// generated resources
	GeneratedResources []kyvernov1.ResourceSpec `yaml:"generatedResources"`
	// expected response from the policy engine
	PolicyResponse response.PolicyResponse `yaml:"policyresponse"`
}

type Input added in v1.5.0

type Input struct {
	Policy        string   `yaml:"policy"`
	Resource      string   `yaml:"resource"`
	LoadResources []string `yaml:"loadresources,omitempty"`
}

Input defines input for a test scenario

type Mutation added in v1.5.0

type Mutation struct {
	// path to the patched resource to be compared with
	PatchedResource string `yaml:"patchedresource,omitempty"`
	// expected response from the policy engine
	PolicyResponse response.PolicyResponse `yaml:"policyresponse"`
}

type Scenario added in v1.5.0

type Scenario struct {
	TestCases []TestCase
}

type TestCase added in v1.5.0

type TestCase struct {
	Input    Input    `yaml:"input"`
	Expected Expected `yaml:"expected"`
}

TestCase defines input and output for a case

type Validation added in v1.5.0

type Validation struct {
	// expected response from the policy engine
	PolicyResponse response.PolicyResponse `yaml:"policyresponse"`
}

Jump to

Keyboard shortcuts

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