test

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFor

func ClientFor(cfg *Config, clientOpts ...func(*clientgorest.Config)) (crclient.Client, error)

func EventuallyObject

func EventuallyObject[T client.Object](t *testing.T, ctx context.Context, objective string, getter func(context.Context) (T, error), predicates []Predicate[T], options ...EventuallyOption)

EventuallyObject polls until the predicate is fulfilled on the object.

func EventuallyObjects

func EventuallyObjects[T client.Object](t *testing.T, ctx context.Context, objective string, getter func(context.Context) ([]T, error), groupPredicates []Predicate[[]T], predicates []Predicate[T], options ...EventuallyOption)

EventuallyObjects polls until the predicate is fulfilled on each of a set of objects.

func RestConfig added in v0.1.5

func RestConfig(cfg *Config) (*clientgorest.Config, error)

Types

type Condition

type Condition struct {
	Type    string
	Status  metav1.ConditionStatus
	Reason  string
	Message string
}

Condition is a generic structure required to adapt all the different concrete condition types into one.

func Conditions

func Conditions(item client.Object) ([]Condition, error)

Conditions extracts conditions from the item and adapts them to the generic wrapper.

func (Condition) Matches

func (needle Condition) Matches(condition Condition) bool

func (Condition) String

func (c Condition) String() string

String formats a condition in the canonical way.

type Config

type Config struct {
	// Images stored in an ACR that requires authentication to pull, but in different repositories.
	AliceImage string
	BobImage   string

	// ARM resource ID for the puller MSI
	PullerResourceID string
	// Client ID for the puller MSI
	PullerClientID string
	// Tenant ID for the puller MSI
	PullerTenantID string
	// FQDN for the registry we're pulling from
	RegistryFQDN string
	// Label selector for the nodes we need to schedule to
	LabelSelector string

	// Path of authentication config for the AKS cluster.
	KubeconfigPath string
}

func LoadConfig

func LoadConfig() (*Config, error)

type EventuallyOption

type EventuallyOption func(*EventuallyOptions)

EventuallyOption configures a

func WithDelayedStart

func WithDelayedStart() EventuallyOption

WithDelayedStart configures the asynchronous assertion to start immediately.

func WithFilteredConditionDump

func WithFilteredConditionDump(matchers ...Condition) EventuallyOption

WithFilteredConditionDump configures the asynchronous assertion to only dump the specified conditions.

func WithInterval

func WithInterval(interval time.Duration) EventuallyOption

WithInterval sets the polling interval.

func WithTimeout

func WithTimeout(timeout time.Duration) EventuallyOption

WithTimeout sets the polling timeout.

func WithoutConditionDump

func WithoutConditionDump() EventuallyOption

WithoutConditionDump configures the asynchronous assertion to dump conditions on failure.

type EventuallyOptions

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

EventuallyOptions configure asynchronous assertion behavior.

type Predicate

type Predicate[T any] func(T) (done bool, reasons string, err error)

Predicate evaluates an object. Return whether the object in question matches your predicate, the reasons why or why not, and whether an error occurred. If determining that an object does not match a predicate, a message is required. Returning an error is fatal to the asynchronous assertion using this predicate.

func ConditionPredicate

func ConditionPredicate[T client.Object](needle Condition) Predicate[T]

ConditionPredicate returns a predicate that validates that a particular condition type exists and has the requisite status, reason and/or message.

Jump to

Keyboard shortcuts

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