testing

package
v0.0.0-...-9940484 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddApplicationConfig

func AddApplicationConfig(clusterBom *hubv1.ClusterBom, id string)

func AddApplicationStatus

func AddApplicationStatus(clusterBom *hubv1.ClusterBom, id, state string, lastOp *hubv1.LastOperation)

func CreateClusterBom

func CreateClusterBom(clusterBomName, overallState string) *hubv1.ClusterBom

func CreateDeployItem

func CreateDeployItem(clusterBomName, id string, generation, observedGeneration int64, isInstallOperation bool, lastOp *hubv1.LastOperation, readiness *hubv1.Readiness) *v1alpha1.DeployItem

func CreateSecret

func CreateSecret(name string) *corev1.Secret

func FakeRawExtensionSampleDi

func FakeRawExtensionSampleDi() *runtime.RawExtension

func FakeRawExtensionWithProperty

func FakeRawExtensionWithProperty(name string) *runtime.RawExtension

func FakeRawExtensionWithPropertyDi

func FakeRawExtensionWithPropertyDi(name string) *runtime.RawExtension

func LastOp

func LastOp(operation string, observedGeneration, successNumber int32, state string, numOfTries int32) hubv1.LastOperation

Types

type FakeReconcileClockDi

type FakeReconcileClockDi struct {
	Time time.Time
}

func (*FakeReconcileClockDi) Now

func (c *FakeReconcileClockDi) Now() time.Time

func (*FakeReconcileClockDi) Sleep

func (c *FakeReconcileClockDi) Sleep(d time.Duration)

type HubControllerTestClientDi

type HubControllerTestClientDi struct {
	TestClientDi
	ReconcileMap *corev1.ConfigMap
}

func (HubControllerTestClientDi) Create

func (HubControllerTestClientDi) Get

func (HubControllerTestClientDi) GetUncached

func (HubControllerTestClientDi) ListUncached

func (t HubControllerTestClientDi) ListUncached(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (HubControllerTestClientDi) Update

type ReactiveMockClient

type ReactiveMockClient struct {
	FakeClient   client.Client
	StatusWriter *ReactiveMockStatusWriter
	ReactorFuncs
}

func NewReactiveMockClient

func NewReactiveMockClient(funcs map[string]func() error, initObjs ...runtime.Object) ReactiveMockClient

func (*ReactiveMockClient) Create

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

func (*ReactiveMockClient) Delete

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

Delete deletes the given obj from Kubernetes cluster.

func (*ReactiveMockClient) DeleteAllOf

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

DeleteAllOf deletes all objects of the given type matching the given options.

func (*ReactiveMockClient) Get

Get retrieves an obj for the given object key from the Kubernetes Cluster. obj must be a struct pointer so that obj can be updated with the response returned by the Server.

func (*ReactiveMockClient) List

List retrieves list of objects for a given namespace and list options. On a successful call, Items field in the list will be populated with the result returned from the server.

func (*ReactiveMockClient) Patch

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

Patch patches the given obj in the Kubernetes cluster. obj must be a struct pointer so that obj can be updated with the content returned by the Server.

func (*ReactiveMockClient) RESTMapper

func (t *ReactiveMockClient) RESTMapper() meta.RESTMapper

func (*ReactiveMockClient) Scheme

func (t *ReactiveMockClient) Scheme() *runtime.Scheme

func (*ReactiveMockClient) Status

func (*ReactiveMockClient) Update

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

Update updates the given obj in the Kubernetes cluster. obj must be a struct pointer so that obj can be updated with the content returned by the Server.

type ReactiveMockStatusWriter

type ReactiveMockStatusWriter struct {
	ReactorFuncs
	FakeClient client.StatusWriter
}

func (*ReactiveMockStatusWriter) Patch

Patch patches the given object's subresource. obj must be a struct pointer so that obj can be updated with the content returned by the Server.

func (*ReactiveMockStatusWriter) Update

type ReactorFuncs

type ReactorFuncs map[string]func() error

type TestClientDi

type TestClientDi struct {
}

func (TestClientDi) Create

func (TestClientDi) Delete

func (TestClientDi) DeleteAllOf

func (TestClientDi) Get

func (TestClientDi) List

func (TestClientDi) Patch

func (TestClientDi) RESTMapper

func (t TestClientDi) RESTMapper() meta.RESTMapper

func (TestClientDi) Scheme

func (t TestClientDi) Scheme() *runtime.Scheme

func (TestClientDi) Status

func (t TestClientDi) Status() client.StatusWriter

func (TestClientDi) Update

type UnitTestClientDi

type UnitTestClientDi struct {
	TestClientDi
	ClusterBoms     map[string]*hubv1.ClusterBom
	DeployItems     map[string]*v1alpha1.DeployItem
	Installations   map[string]*v1alpha1.Installation
	Secrets         map[string]*corev1.Secret
	ClusterBomSyncs map[string]*hubv1.ClusterBomSync
}

Begin Unit Test Client that holds object in memory to be used as client mock

func NewUnitTestClientDi

func NewUnitTestClientDi() *UnitTestClientDi

func NewUnitTestClientWithCBDi

func NewUnitTestClientWithCBDi(bom *hubv1.ClusterBom) *UnitTestClientDi

func NewUnitTestClientWithCBandDI

func NewUnitTestClientWithCBandDI(bom *hubv1.ClusterBom, deployItem *v1alpha1.DeployItem) *UnitTestClientDi

func NewUnitTestClientWithCBandDis

func NewUnitTestClientWithCBandDis(bom *hubv1.ClusterBom, deployItems ...*v1alpha1.DeployItem) *UnitTestClientDi

func NewUnitTestClientWithDi

func NewUnitTestClientWithDi(deployItem *v1alpha1.DeployItem) *UnitTestClientDi

func (UnitTestClientDi) AddClusterBom

func (t UnitTestClientDi) AddClusterBom(bom *hubv1.ClusterBom)

func (UnitTestClientDi) AddClusterBomSync

func (t UnitTestClientDi) AddClusterBomSync(sync *hubv1.ClusterBomSync)

func (UnitTestClientDi) AddDeployItem

func (t UnitTestClientDi) AddDeployItem(deployItem *v1alpha1.DeployItem)

func (UnitTestClientDi) AddSecret

func (t UnitTestClientDi) AddSecret(secret *corev1.Secret)

func (UnitTestClientDi) Create

func (t UnitTestClientDi) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (UnitTestClientDi) Delete

func (t UnitTestClientDi) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (UnitTestClientDi) Get

func (UnitTestClientDi) GetUncached

func (t UnitTestClientDi) GetUncached(ctx context.Context, key client.ObjectKey, obj client.Object) error

func (UnitTestClientDi) List

func (UnitTestClientDi) ListUncached

func (t UnitTestClientDi) ListUncached(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (UnitTestClientDi) Status

func (UnitTestClientDi) Update

func (t UnitTestClientDi) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type UnitTestDeleteErrorClientDi

type UnitTestDeleteErrorClientDi struct {
	UnitTestClientDi
}

UnitTestDeleteErrorClient is a UnitTestClient whose Delete method fails.

func NewUnitTestDeleteErrorClientDi

func NewUnitTestDeleteErrorClientDi() *UnitTestDeleteErrorClientDi

func (UnitTestDeleteErrorClientDi) Delete

type UnitTestGetErrorClientDi

type UnitTestGetErrorClientDi struct {
	UnitTestClientDi
}

UnitTestGetErrorClient is a UnitTestClient whose Get method fails.

func NewUnitTestGetErrorClientDi

func NewUnitTestGetErrorClientDi() *UnitTestGetErrorClientDi

func (UnitTestGetErrorClientDi) Get

type UnitTestListErrorClientDi

type UnitTestListErrorClientDi struct {
	UnitTestClientDi
}

UnitTestListErrorClient is a UnitTestClient whose List method fails.

func NewUnitTestListErrorClientDi

func NewUnitTestListErrorClientDi() *UnitTestListErrorClientDi

func (UnitTestListErrorClientDi) List

type UnitTestStatusErrorClientDi

type UnitTestStatusErrorClientDi struct {
	UnitTestClientDi
}

UnitTestStatusErrorClient is a UnitTestClient whose Status method return a UnitTestStatusErrorWriter.

func NewUnitTestStatusErrorClientDi

func NewUnitTestStatusErrorClientDi() *UnitTestStatusErrorClientDi

func (UnitTestStatusErrorClientDi) Status

type UnitTestStatusErrorWriterDi

type UnitTestStatusErrorWriterDi struct {
}

UnitTestStatusErrorWriter is a StatusWriter whose Update method fails.

func (*UnitTestStatusErrorWriterDi) Patch

func (*UnitTestStatusErrorWriterDi) Update

type UnitTestStatusWriterDi

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

func (*UnitTestStatusWriterDi) Patch

func (*UnitTestStatusWriterDi) Update

Jump to

Keyboard shortcuts

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