testing

package
v0.3.1-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakeClientResourceVersion = "999"
)

Variables

This section is empty.

Functions

func RunTests

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

Types

type Compare

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

type FakeSyncer

type FakeSyncer struct {
	ForwardCreateFn       func(ctx context.Context, vObj client.Object, log loghelper.Logger) (ctrl.Result, error)
	ForwardUpdateFn       func(ctx context.Context, pObj client.Object, vObj client.Object, log loghelper.Logger) (ctrl.Result, error)
	ForwardUpdateNeededFn func(pObj runtime.Object, vObj client.Object) (bool, error)

	BackwardUpdateFn       func(ctx context.Context, pObj client.Object, vObj client.Object, log loghelper.Logger) (ctrl.Result, error)
	BackwardUpdateNeededFn func(pObj client.Object, vObj client.Object) (bool, error)
}

func (*FakeSyncer) BackwardUpdate

func (f *FakeSyncer) BackwardUpdate(ctx context.Context, pObj client.Object, vObj client.Object, log loghelper.Logger) (ctrl.Result, error)

func (*FakeSyncer) BackwardUpdateNeeded

func (f *FakeSyncer) BackwardUpdateNeeded(pObj client.Object, vObj client.Object) (bool, error)

func (*FakeSyncer) ForwardCreate

func (f *FakeSyncer) ForwardCreate(ctx context.Context, vObj client.Object, log loghelper.Logger) (ctrl.Result, error)

func (*FakeSyncer) ForwardUpdate

func (f *FakeSyncer) ForwardUpdate(ctx context.Context, pObj client.Object, vObj client.Object, log loghelper.Logger) (ctrl.Result, error)

func (*FakeSyncer) ForwardUpdateNeeded

func (f *FakeSyncer) ForwardUpdateNeeded(pObj client.Object, vObj client.Object) (bool, error)

func (*FakeSyncer) New

func (f *FakeSyncer) New() client.Object

func (*FakeSyncer) NewList

func (f *FakeSyncer) NewList() client.ObjectList

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 context.Context, pClient *testingutil.FakeIndexClient, vClient *testingutil.FakeIndexClient, scheme *runtime.Scheme, log loghelper.Logger)
	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