framework

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: LGPL-2.1 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunID = uuid.NewUUID()

RunID is a unique identifier of the integration run. Beware that this ID is not the same for all tests in the e2e run, because each Ginkgo node creates it separately.

Functions

func ExpectError

func ExpectError(err error, explain ...interface{})

ExpectError expects an error happens, otherwise an exception raises

func ExpectNoError

func ExpectNoError(err error, explain ...interface{})

ExpectNoError checks if "err" is set, and if so, fails assertion while logging the error.

func Logf

func Logf(format string, args ...interface{})

Logf logs the info.

func RandomAlphabaticalString

func RandomAlphabaticalString(length int) string

RandomAlphabaticalString generates a random alphabatical string of given length

func RandomStringWithCharset

func RandomStringWithCharset(length int, charset string) string

RandomStringWithCharset generates a random string of given length from the given charset

Types

type Framework

type Framework struct {
	BaseName   string
	UniqueName string

	Client    client.Client
	ClientSet clientset.Interface

	Namespace *corev1.Namespace
	// contains filtered or unexported fields
}

Framework supports common operations used by e2e tests; it will keep a client & a namespace for you.

func NewDefaultFramework

func NewDefaultFramework(baseName string, options ...Options) *Framework

NewDefaultFramework creates a new Test Framework with default options (like RootPath)

func NewFramework

func NewFramework(baseName string, options Options) *Framework

NewFramework creates a new Test Framework with CRDs

func (Framework) CreateNamespace

func (f Framework) CreateNamespace(baseName string, labels map[string]string) (*corev1.Namespace, error)

CreateNamespace creates a new namespace with randomized name from the given baseName and labels

func (*Framework) GetManager

func (f *Framework) GetManager() ctrl.Manager

GetManager either gets an existing manager or creates a new one

func (Framework) GetNamespace

func (f Framework) GetNamespace() string

GetNamespace returns the ephemeral namespace for the test

func (Framework) GetRootPath

func (f Framework) GetRootPath() string

GetRootPath returns the configured root path of controller

func (*Framework) InitOnRunningSuite

func (f *Framework) InitOnRunningSuite()

InitOnRunningSuite sets up ginkgo's BeforeEach & AfterEach. It must be called within running ginkgo suite (like Describe, Context etc)

func (*Framework) Start

func (f *Framework) Start()

Start bootstraps the test env and sets the client

func (*Framework) TeardownCluster

func (f *Framework) TeardownCluster()

TeardownCluster stops the test environment

type Options

type Options struct {
	UseManager            bool
	SkipNamespaceCreation bool
	RootPath              string
}

Options describe configuration for test framework

Jump to

Keyboard shortcuts

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