Back to

Package environment

Latest Go to latest

The latest major version is .

Published: Sep 25, 2020 | License: Apache-2.0 | Module:


func DumpENV

func DumpENV(namespace string)

DumpENV executes testing/ to write k8s resources to files

func GetNamespaceName

func GetNamespaceName(namespaceCounter int) string

GetNamespaceName returns a numbered namespace

func KubeConfig

func KubeConfig() (*rest.Config, error)

KubeConfig returns a kube config for this environment

func NamespaceDeletionInProgress

func NamespaceDeletionInProgress(err error) bool

NamespaceDeletionInProgress returns true if the error indicates deletion will happen eventually

func NukeNamespaces

func NukeNamespaces(namespacesToNuke []string)

NukeNamespaces uses the kubectl command to remove remaining test namespaces. Used in AfterSuite.

func SetupNamespace

func SetupNamespace(e *Environment, m machine.Machine, labels map[string]string) error

SetupNamespace creates a new labeled namespace and sets the teardown func in the environment

type Environment

type Environment struct {
	ID           int
	KubeConfig   *rest.Config
	Log          *zap.SugaredLogger
	TeardownFunc machine.TearDownFunc
	Config       *config.Config
	ObservedLogs *observer.ObservedLogs
	Namespace    string
	Stop         chan struct{}

Environment starts our operator and handles interaction with the k8s cluster used in the tests

func (*Environment) AllLogMessages

func (e *Environment) AllLogMessages() (msgs []string)

AllLogMessages returns only the message part of existing logs to aid in debugging

func (*Environment) FlushLog

func (e *Environment) FlushLog() error

FlushLog flushes the zap log

func (*Environment) SetupLoggerContext

func (e *Environment) SetupLoggerContext(prefix string) context.Context

SetupLoggerContext sets up the logger and puts it into a new context

func (*Environment) StartManager

func (e *Environment) StartManager(mgr manager.Manager)

StartManager is used to clean up the test environment

func (*Environment) Teardown

func (e *Environment) Teardown(wasFailure bool)

Teardown is used to clean up the test environment

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier