testutil

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Backoff = wait.Backoff{
	Steps:    10,
	Duration: 10 * time.Millisecond,
	Factor:   2.0,
	Jitter:   0.1,
	Cap:      time.Minute,
}

Functions

func AtLeastVersion

func AtLeastVersion(t *testing.T, minor int) bool

func Eventually

func Eventually(t testing.TB, fn func() bool)

func NewClient

func NewClient(t testing.TB) client.Client

func NewClientWithInterceptors

func NewClientWithInterceptors(t testing.TB, ict *interceptor.Funcs) client.Client

func NewContext

func NewContext(t *testing.T) context.Context

func NewReadOnlyClient added in v0.0.6

func NewReadOnlyClient(t testing.TB, objs ...runtime.Object) client.Client

func SomewhatEventually

func SomewhatEventually(t testing.TB, dur time.Duration, fn func() bool)

func WithFakeExecutor added in v0.0.10

func WithFakeExecutor(t *testing.T, mgr *Manager, sh execution.SynthesizerHandle)

Types

type Manager

type Manager struct {
	ctrl.Manager
	RestConfig           *rest.Config
	DownstreamRestConfig *rest.Config  // may or may not == RestConfig
	DownstreamClient     client.Client // may or may not == Manager.GetClient()
	DownstreamEnv        *envtest.Environment
}

func NewManager

func NewManager(t *testing.T, testOpts ...TestManagerOption) *Manager

NewManager starts one or two envtest environments depending on the env. This should work seamlessly when run locally assuming binaries have been fetched with setup-envtest. In CI the second environment is used to compatibility test against a matrix of k8s versions. This compatibility testing is tightly coupled to the github action and not expected to work locally.

func (*Manager) GetCurrentResourceSlices added in v0.0.2

func (m *Manager) GetCurrentResourceSlices(ctx context.Context) ([]*apiv1.ResourceSlice, error)

func (*Manager) Start

func (m *Manager) Start(t *testing.T)

type TestManagerOption added in v0.0.4

type TestManagerOption func(*manager.Options)

func WithCompositionNamespace added in v0.0.6

func WithCompositionNamespace(ns string) TestManagerOption

func WithPodNamespace added in v0.0.4

func WithPodNamespace(ns string) TestManagerOption

Jump to

Keyboard shortcuts

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