envtest

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package envtest provides libraries for integration testing by starting a local control plane

Index

Constants

View Source
const (
	StartTimeout = 60
	StopTimeout  = 60
)

Default binary path for test framework

Variables

This section is empty.

Functions

func CreateCRDs

func CreateCRDs(config *rest.Config, crds []*apiextensionsv1beta1.CustomResourceDefinition) error

CreateCRDs creates the CRDs

func InstallCRDs

InstallCRDs installs a collection of CRDs into a cluster by reading the crd yaml files from a directory

func WaitForCRDs

func WaitForCRDs(config *rest.Config, crds []*apiextensionsv1beta1.CustomResourceDefinition, options CRDInstallOptions) error

WaitForCRDs waits for the CRDs to appear in discovery

Types

type CRDInstallOptions

type CRDInstallOptions struct {
	// Paths is the path to the directory containing CRDs
	Paths []string

	// CRDs is a list of CRDs to install
	CRDs []*apiextensionsv1beta1.CustomResourceDefinition

	// ErrorIfPathMissing will cause an error if a Path does not exist
	ErrorIfPathMissing bool
	// contains filtered or unexported fields
}

CRDInstallOptions are the options for installing CRDs

type Environment

type Environment struct {
	// ControlPlane is the ControlPlane including the apiserver and etcd
	ControlPlane integration.ControlPlane

	// Config can be used to talk to the apiserver
	Config *rest.Config

	// CRDs is a list of CRDs to install
	CRDs []*apiextensionsv1beta1.CustomResourceDefinition

	// CRDDirectoryPaths is a list of paths containing CRD yaml or json configs.
	CRDDirectoryPaths []string

	// UseExisting indicates that this environments should use an
	// existing kubeconfig, instead of trying to stand up a new control plane.
	// This is useful in cases that need aggregated API servers and the like.
	UseExistingCluster bool

	// ControlPlaneStartTimeout is the the maximum duration each controlplane component
	// may take to start. It defaults to the KUBEBUILDER_CONTROLPLANE_START_TIMEOUT
	// environment variable or 20 seconds if unspecified
	ControlPlaneStartTimeout time.Duration

	// ControlPlaneStopTimeout is the the maximum duration each controlplane component
	// may take to stop. It defaults to the KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT
	// environment variable or 20 seconds if unspecified
	ControlPlaneStopTimeout time.Duration
}

Environment creates a Kubernetes test environment that will start / stop the Kubernetes control plane and install extension APIs

func (*Environment) Start

func (te *Environment) Start() (*rest.Config, error)

Start starts a local Kubernetes server and updates te.ApiserverPort with the port it is listening on

func (*Environment) Stop

func (te *Environment) Stop() error

Stop stops a running server

type NewlineReporter

type NewlineReporter = printer.NewlineReporter

NewlineReporter is Reporter that Prints a newline after the default Reporter output so that the results are correctly parsed by test automation. See issue https://github.com/jstemmer/go-junit-report/issues/31 It's re-exported here to avoid compatibility breakage/mass rewrites.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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