test

package
v0.0.0-...-f39afbd Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestNamespace     = ""
	OperatorNamespace = "node-observability-operator"
	// nolint - ignore G101: not applicable
	KubeletCASourceNamespace = "openshift-config-managed"
)

Variables

View Source
var (
	Scheme = runtime.NewScheme()
)

Functions

func IndexEvents

func IndexEvents(events []Event) map[string]Event

IndexEvents turns the slice of events into a map for the more convenient lookups.

Types

type Event

type Event struct {
	EventType watch.EventType
	ObjType   string
	types.NamespacedName
}

Event is a simplified representation of the watch event received from the controller runtime client.

func NewEvent

func NewEvent(we watch.Event) Event

NewEvent returns an event instance created from the controller runtime's watch event.

func (Event) Key

func (e Event) Key() string

Key returns a key like representation of the event.

type EventCollector

type EventCollector struct {
	T          *testing.T
	Client     client.WithWatch
	WatchTypes []client.ObjectList
	Verbose    bool
	// contains filtered or unexported fields
}

EventCollector collects all types of events for the given watch types.

func NewEventCollector

func NewEventCollector(t *testing.T, client client.WithWatch, watchTypes []client.ObjectList, bufSize int) *EventCollector

NewEventCollector returns an instance of the event collector.

func (*EventCollector) Collect

func (c *EventCollector) Collect(num int, timeout time.Duration) []Event

Collect collects events until the given number is reached or until the timeout is expired.

func (*EventCollector) Start

func (c *EventCollector) Start(ctx context.Context)

Start starts watches for all the watch types.

func (*EventCollector) Stop

func (c *EventCollector) Stop()

Stop stops all the watches.

Jump to

Keyboard shortcuts

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