Package environment adds everything around mgr.Start() to run a local operator for the integration test suites



This section is empty.


This section is empty.


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
	// contains filtered or unexported fields

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