framework

package
v0.0.0-...-2b86969 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout is the default timeout for eventually and consistently assertions.
	DefaultTimeout = 60 * time.Second

	// DefaultInterval is the default interval for eventually and consistently assertions.
	DefaultInterval = 5 * time.Second

	// MachineAPINamespace is the name of the openshift-machine-api namespace.
	MachineAPINamespace = "openshift-machine-api"

	// ControlPlaneMachineSetName is the name of the control plane machine set in all clusters.
	ControlPlaneMachineSetName = "cluster"
)

Variables

This section is empty.

Functions

func Async

func Async(wg *sync.WaitGroup, cancel context.CancelFunc, testFunc func() bool)

Async runs the test function as an asynchronous goroutine. If the test function returns false, the cancel will be called. This allows to cancel the context if the test function fails.

func ControlPlaneMachineSetSelectorLabels

func ControlPlaneMachineSetSelectorLabels() map[string]string

ControlPlaneMachineSetSelectorLabels are the set of labels use to select control plane machines within the cluster.

func Periodic

func Periodic() ginkgo.Labels

Periodic is a periodic ginkgo label.

func PreSubmit

func PreSubmit() ginkgo.Labels

PreSubmit is a presubmit ginkgo label.

func RunCheckUntil

func RunCheckUntil(ctx context.Context, check, condition func(context.Context, GomegaAssertions) bool) bool

RunCheckUntil runs the check function until the condition succeeds or the context is cancelled. If the check fails before the condition succeeds, the test will fail. The check and condition functions must use the passed Gomega for any assertions so that we can handle failures within the functions appropriately.

Types

type Framework

type Framework interface {
	// ControlPlaneMachineSetKey returns the object key for fetching a control plane
	// machine set.
	ControlPlaneMachineSetKey() runtimeclient.ObjectKey

	// LoadClient returns a new controller-runtime client.
	GetClient() runtimeclient.Client

	// GetContext returns a context.
	GetContext() context.Context

	// GetPlatformType returns the platform type.
	GetPlatformType() configv1.PlatformType

	// GetPlatformSupportLevel returns the support level for the current platform.
	GetPlatformSupportLevel() PlatformSupportLevel

	// GetScheme returns the scheme.
	GetScheme() *runtime.Scheme

	// NewEmptyControlPlaneMachineSet returns a new control plane machine set with
	// just the name and namespace set.
	NewEmptyControlPlaneMachineSet() *machinev1.ControlPlaneMachineSet

	// IncreaseProviderSpecInstanceSize increases the instance size of the
	// providerSpec passed. This is used to trigger updates to the Machines
	// managed by the control plane machine set.
	IncreaseProviderSpecInstanceSize(providerSpec *runtime.RawExtension) error

	// TagInstanceInProviderSpec tags the instance in the provider spec.
	TagInstanceInProviderSpec(providerSpec *runtime.RawExtension) error

	// ConvertToControlPlaneMachineSetProviderSpec converts a control plane machine provider spec
	// to a control plane machine set suitable provider spec.
	ConvertToControlPlaneMachineSetProviderSpec(providerSpec machinev1beta1.ProviderSpec) (*runtime.RawExtension, error)

	// UpdateDefaultedValueFromCPMS updates a field that is defaulted by the defaulting webhook in the MAO with a desired value.
	UpdateDefaultedValueFromCPMS(rawProviderSpec *runtime.RawExtension) (*runtime.RawExtension, error)
}

Framework is an interface for getting clients and information about the environment within test cases.

func NewFramework

func NewFramework() (Framework, error)

NewFramework initialises a new test framework for the E2E suite.

func NewFrameworkWith

func NewFrameworkWith(sch *runtime.Scheme, client runtimeclient.Client, platform configv1.PlatformType, supportLevel PlatformSupportLevel, namespace string) Framework

NewFrameworkWith initialises a new test framework for the E2E suite using the existing scheme, client, platform and support level provided.

type GomegaAssertions

type GomegaAssertions interface {
	Ω(actual interface{}, extra ...interface{}) gomega.Assertion //nolint:asciicheck
	Expect(actual interface{}, extra ...interface{}) gomega.Assertion
	ExpectWithOffset(offset int, actual interface{}, extra ...interface{}) gomega.Assertion
}

GomegaAssertions is a subset of the gomega.Gomega interface. It is the set allowed for checks and conditions in the RunCheckUntil helper function.

type PlatformSupportLevel

type PlatformSupportLevel int

PlatformSupportLevel is used to identify which tests should run based on the platform.

const (
	// Unsupported means that the platform is not supported
	// by CPMS.
	Unsupported PlatformSupportLevel = iota
	// Manual means that the platform is supported by CPMS,
	// but the CPMS must be created manually.
	Manual
	// Full means that the platform is supported by CPMS,
	// and the CPMS will be created automatically.
	Full
)

Jump to

Keyboard shortcuts

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