testing

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakeClientResourceVersion = "999"
)

Variables

This section is empty.

Functions

func NewFakeMapper

func NewFakeMapper(scheme *runtime.Scheme) meta.RESTMapper

NewFakeMapper creates a new fake mapper

func NewFakeRegisterContext

func NewFakeRegisterContext(pClient *FakeIndexClient, vClient *FakeIndexClient) *synccontext.RegisterContext

func NewScheme

func NewScheme() *runtime.Scheme

NewScheme creates a new scheme

func RunTests

func RunTests(t *testing.T, tests []*SyncTest)

Types

type Compare

type Compare func(obj1 runtime.Object, obj2 runtime.Object) bool

type FakeIndexClient

type FakeIndexClient struct {
	client.Client
	// contains filtered or unexported fields
}

func NewFakeClient

func NewFakeClient(scheme *runtime.Scheme, objs ...runtime.Object) *FakeIndexClient

NewFakeClient creates a new fake client for the standard schema

func (*FakeIndexClient) Create

func (fc *FakeIndexClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*FakeIndexClient) Delete

func (fc *FakeIndexClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*FakeIndexClient) DeleteAllOf

func (fc *FakeIndexClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

func (*FakeIndexClient) Get

func (*FakeIndexClient) IndexField

func (fc *FakeIndexClient) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error

func (*FakeIndexClient) List

func (fc *FakeIndexClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (*FakeIndexClient) Patch

func (fc *FakeIndexClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*FakeIndexClient) Update

func (fc *FakeIndexClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type SyncTest

type SyncTest struct {
	Name string

	InitialPhysicalState []runtime.Object
	InitialVirtualState  []runtime.Object

	ExpectedPhysicalState map[schema.GroupVersionKind][]runtime.Object
	ExpectedVirtualState  map[schema.GroupVersionKind][]runtime.Object

	Sync    func(ctx *synccontext.RegisterContext)
	Compare Compare
}

func (*SyncTest) Run

func (s *SyncTest) Run(t *testing.T)

Jump to

Keyboard shortcuts

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