testutil

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 34 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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