framework

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Framework

type Framework struct {
	// contains filtered or unexported fields
}

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

func NewDefaultFramework

func NewDefaultFramework(addToSchemeFuncs ...func(s *runtime.Scheme) error) *Framework

NewDefaultFramework makes a new framework and sets up clientsets.

func NewFramework

func NewFramework(options Options, client ctrlclient.Client, addToSchemeFuncs ...func(s *runtime.Scheme) error) *Framework

NewFramework creates a test framework.

func NewFrameworkWithCustomTimeouts

func NewFrameworkWithCustomTimeouts(timeouts *TimeoutContext, addToSchemeFuncs ...func(s *runtime.Scheme) error) *Framework

NewFrameworkWithCustomTimeouts makes a framework with with custom timeouts.

func (*Framework) ClientConfig

func (f *Framework) ClientConfig() *rest.Config

ClientConfig returns rest configs

func (*Framework) ExpectConsistOf

func (f *Framework) ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})

ExpectConsistOf expects actual contains precisely the extra elements. The ordering of the elements does not matter.

func (*Framework) ExpectEmpty

func (f *Framework) ExpectEmpty(actual interface{}, explain ...interface{})

ExpectEmpty expects actual is empty

func (*Framework) ExpectEqual

func (f *Framework) ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})

ExpectEqual expects the specified two are the same, otherwise an exception raises

func (*Framework) ExpectError

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

ExpectError expects an error happens, otherwise an exception raises

func (*Framework) ExpectHaveKey

func (f *Framework) ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})

ExpectHaveKey expects the actual map has the key in the keyset

func (*Framework) ExpectNoError

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

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

func (*Framework) ExpectNoErrorWithOffset

func (f *Framework) 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 (*Framework) ExpectNotEqual

func (f *Framework) ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})

ExpectNotEqual expects the specified two are not the same, otherwise an exception raises

func (*Framework) GetClient

func (f *Framework) GetClient() ctrlclient.Client

GetClient returns controller runtime client

func (*Framework) GetScheme

func (f *Framework) GetScheme() *runtime.Scheme

GetScheme returns scheme

func (*Framework) GetTimeouts

func (f *Framework) GetTimeouts() *TimeoutContext

GetTimeouts returns timeouts

type Options

type Options struct {
	ClientQPS   float32
	ClientBurst int
}

Options is a struct for managing test framework options.

type TimeoutContext

type TimeoutContext struct {
	// PodStart is how long to wait for the pod to be started.
	PodStart time.Duration

	// PodStartShort is same as `PodStart`, but shorter.
	// Use it in a case-by-case basis, mostly when you are sure pod start will not be delayed.
	PodStartShort time.Duration

	// PodStartSlow is same as `PodStart`, but longer.
	// Use it in a case-by-case basis, mostly when you are sure pod start will take longer than usual.
	PodStartSlow time.Duration

	// PodDelete is how long to wait for the pod to be deleted.
	PodDelete time.Duration

	// ClaimProvision is how long claims have to become dynamically provisioned.
	ClaimProvision time.Duration

	// DataSourceProvision is how long claims have to become dynamically provisioned from source claim.
	DataSourceProvision time.Duration

	// ClaimProvisionShort is the same as `ClaimProvision`, but shorter.
	ClaimProvisionShort time.Duration

	// ClaimBound is how long claims have to become bound.
	ClaimBound time.Duration

	// PVReclaim is how long PVs have to become reclaimed.
	PVReclaim time.Duration

	// PVBound is how long PVs have to become bound.
	PVBound time.Duration

	// PVCreate is how long PVs have to be created.
	PVCreate time.Duration

	// PVDelete is how long PVs have to become deleted.
	PVDelete time.Duration

	// PVDeleteSlow is the same as PVDelete, but slower.
	PVDeleteSlow time.Duration

	// SnapshotCreate is how long for snapshot to create snapshotContent.
	SnapshotCreate time.Duration

	// SnapshotDelete is how long for snapshot to delete snapshotContent.
	SnapshotDelete time.Duration

	// SnapshotControllerMetrics is how long to wait for snapshot controller metrics.
	SnapshotControllerMetrics time.Duration
}

TimeoutContext contains timeout settings for several actions.

func NewTimeoutContextWithDefaults

func NewTimeoutContextWithDefaults() *TimeoutContext

NewTimeoutContextWithDefaults returns a TimeoutContext with default values.

Jump to

Keyboard shortcuts

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