fixture

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Set = &defaultFixtureSet{
	fixtures: map[Key]Fixture{},
}

Set is the default FixtureSet.

Functions

func AddFromFile

func AddFromFile(filePath string) error

AddFromFile parses all the YAML objects from the given file and stores them in the default fixture set.

Types

type Fixture

type Fixture []byte

Fixture captures a single Kubernetes object that can be used as a test fixture. The fixture is stored as a YAML string so that is can be succinctly copied and losslessly rewritten.

func (Fixture) AsNode

func (f Fixture) AsNode() *yaml.RNode

AsNode returns a copy of the fixture as a yaml.RNode.

func (Fixture) AsUnstructured

func (f Fixture) AsUnstructured() *unstructured.Unstructured

AsUnstructured returns a copy of the fixture as a unstructured.Unstructured object.

func (Fixture) Rename

func (f Fixture) Rename(newName string) (Fixture, error)

Rename updates the `metadata.name` and `metadata.namespace` fields of the fixture. YAML anchors are preserved so if the updated values of these fields will continue to be propagated to aliases.

type FixtureSet

type FixtureSet interface {
	Insert(Key, Fixture)
	Match(u *unstructured.Unstructured) Fixture
}

FixtureSet is a collection of fixture objects. nolint(golint)

type Key

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

Key is the indexing fixture set key.

func KeyFor

func KeyFor(u *unstructured.Unstructured) Key

KeyFor returns the key for indexing the given object.

Jump to

Keyboard shortcuts

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