test

package
v0.0.0-...-d680719 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

README

End-to-End Tests

Running All E2E Tests

To run e2e tests call the following go command:

$ go test -tags=e2e ./test/...

Running a Single E2E Test

Each test is given its own directory to avoid all the test code sharing a single module namespace and accidentally clobbering each others helper functions and types.

To run a single test on its own, use the path to the its directory. For example, run just smoke_test:

$ go test -tags=e2e ./test/smoke_test/...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToInformer

func AddToInformer(t *testing.T, store cache.Store) func(ktesting.Action) (bool, runtime.Object, error)

AddToInformer returns a function to add ktesting.Actions to the cache store

func PrependResourceVersionReactor

func PrependResourceVersionReactor(f *ktesting.Fake)

PrependResourceVersionReactor will instrument a client-go testing Fake with a reactor that simulates resourceVersion changes on mutations. This does not work with patches.

func SeedTestData

func SeedTestData(t *testing.T, ctx context.Context, d Data) (Clients, Informers)

SeedTestData returns Clients and Informers populated with the given Data. nolint: revive

Types

type Assets

type Assets struct {
	Logger     *zap.SugaredLogger
	Controller *controller.Impl
	Clients    Clients
	Informers  Informers
	Recorder   *record.FakeRecorder
	Ctx        context.Context
}

Assets holds references to the controller, logs, clients, and informers.

type Clients

type Clients struct {
	ResolutionRequests *fakeresolutionclientset.Clientset
	Kube               *fakekubeclientset.Clientset
}

Clients holds references to clients which are useful for reconciler tests.

type Data

type Data struct {
	ResolutionRequests []*v1alpha1.ResolutionRequest
	Namespaces         []*corev1.Namespace
	ConfigMaps         []*corev1.ConfigMap
	ServiceAccounts    []*corev1.ServiceAccount
	LimitRange         []*corev1.LimitRange
}

Data represents the desired state of the system (i.e. existing resources) to seed controllers with.

type Informers

Informers holds references to informers which are useful for reconciler tests.

type ResourceVersionReactor

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

ResourceVersionReactor is an implementation of Reactor for our tests

func (*ResourceVersionReactor) Handles

func (r *ResourceVersionReactor) Handles(action ktesting.Action) bool

Handles returns whether our test reactor can handle a given ktesting.Action

func (*ResourceVersionReactor) React

func (r *ResourceVersionReactor) React(action ktesting.Action) (handled bool, ret runtime.Object, err error)

React is noop-function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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