testutil

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 32 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 SomewhatEventually

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

Types

type ExecConn

type ExecConn struct {
	Hook    func(s *apiv1.Synthesizer) []client.Object
	PodHook func(p *corev1.Pod)
	Calls   atomic.Int64
}

func (*ExecConn) Synthesize

func (e *ExecConn) Synthesize(ctx context.Context, syn *apiv1.Synthesizer, pod *corev1.Pod, input []byte) (io.Reader, error)

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 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