e2e

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

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

Functions

func CreateTestingNS

func CreateTestingNS(baseName string, c client.Client, labels map[string]string) (*corev1.Namespace, error)

CreateTestingNS should be used by every test, note that we append a common prefix to the provided test name. Please see NewFramework instead of using this directly.

func ExpectNoError

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

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

func ExpectNoErrorWithOffset

func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})

ExpectNoErrorWithOffset checks if "err" is set, and if so, fails assertion while logging the error at "offset" levels above its caller (for example, for call chain f -> g -> ExpectNoErrorWithOffset(1, ...) error would be logged for "f").

func Logf

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

Logf logs the info.

func RandomSuffix

func RandomSuffix() string

RandomSuffix provides a random string to append to namespace, operationset and diagnosis.

Types

type Framework

type Framework struct {
	BaseName string
	context.Context
	KubeClient  client.Client
	Namespace   *corev1.Namespace // Every test has at least one namespace unless creation is skipped
	SelectorKey string            // selectorKey is the key of lable map.
}

func NewDefaultFramework

func NewDefaultFramework(baseName string) *Framework

NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).

func NewFramework

func NewFramework(baseName string) *Framework

NewFramework creates a test framework.

func (*Framework) AfterEach

func (f *Framework) AfterEach()

AfterEach deletes the namespace.

func (*Framework) BeforeEach

func (f *Framework) BeforeEach()

BeforeEach gets a client and makes a namespace.

func (*Framework) GetRandomNode

func (f *Framework) GetRandomNode() (*corev1.Node, error)

GetRandomNode Chooses a random node

func (*Framework) NewDiagnosis

func (f *Framework) NewDiagnosis(name, ns, nodeName, operationSet string) *diagnosisv1.Diagnosis

NewDiagnosis returns a diagnosis with specified operationset.

func (*Framework) NewDiagnosisWithRandomNode

func (f *Framework) NewDiagnosisWithRandomNode(name, ns, operationSet string) *diagnosisv1.Diagnosis

func (*Framework) NewSimpleOperationset

func (f *Framework) NewSimpleOperationset(name string, ns string, operationName string) *diagnosisv1.OperationSet

NewSimpleOperationset returns an operationset with only one operation.

Jump to

Keyboard shortcuts

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