environment

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 27 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpENV

func DumpENV(namespace string)

DumpENV executes testing/dump_env.sh 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

Types

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

Jump to

Keyboard shortcuts

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