test

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCreate added in v1.0.0

func AssertCreate(t *testing.T, c *client.Client, resource meta.ResourceObject)

AssertCreate creates the given resource and asserts that it isn't existed before

func AssertFetchMustExist added in v0.12.0

func AssertFetchMustExist(t *testing.T, client *client.Client, resource meta.ResourceObject)

AssertFetchMustExist fetches the given object and verify if exists in the context without errors

func AssertFetchWithKeyMustExist added in v0.14.0

func AssertFetchWithKeyMustExist(t *testing.T, client *client.Client, resource meta.ResourceObject, instance metav1.Object)

AssertFetchWithKeyMustExist fetches the given object with the defined key and verify if it exists in the context without errors

func AssertReconcile added in v0.12.0

func AssertReconcile(t *testing.T, r reconcile.Reconciler, instance metav1.Object) (result reconcile.Result)

AssertReconcile asserts if the reconcile.Reconciler call finished without errors

func AssertReconcileMustNotRequeue added in v0.12.0

func AssertReconcileMustNotRequeue(t *testing.T, r reconcile.Reconciler, instance metav1.Object) (result reconcile.Result)

AssertReconcileMustNotRequeue asserts the reconciliation result and that the result DOES NOT add the object in the reconciliation queue again

func AssertReconcileMustRequeue added in v0.12.0

func AssertReconcileMustRequeue(t *testing.T, r reconcile.Reconciler, instance metav1.Object) (result reconcile.Result)

AssertReconcileMustRequeue asserts the reconciliation result and that the result adds the object in the reconciliation queue again

func CreateFakeClient

func CreateFakeClient(objects []runtime.Object, imageObjs []runtime.Object, buildObjs []runtime.Object) *client.Client

CreateFakeClient will create a fake client for mock test on Kubernetes env, use cases that depends on OpenShift should use CreateFakeClientOnOpenShift Deprecated: use NewFakeClientBuilder().Build() instead.

func CreateFakeClientOnOpenShift added in v0.7.0

func CreateFakeClientOnOpenShift(objects []runtime.Object, imageObjs []runtime.Object, buildObjs []runtime.Object) *client.Client

CreateFakeClientOnOpenShift same as CreateFakeClientWithDisco setting openshift flag to true Deprecated: use NewFakeClientBuilder().OnOpenShift().Build() instead.

func CreateFakeKogitoInfinispan added in v0.16.0

func CreateFakeKogitoInfinispan(namespace string) *v1beta1.KogitoInfra

CreateFakeKogitoInfinispan create fake kogito infra instance for Infinispan

func CreateFakeKogitoKafka added in v0.16.0

func CreateFakeKogitoKafka(namespace string) *v1beta1.KogitoInfra

CreateFakeKogitoKafka create fake kogito infra instance for kafka

func GenerateShortUID added in v0.12.0

func GenerateShortUID(count int) string

GenerateShortUID same as GenerateUID, but returns a fraction of the generated UID instead. If count > than UID total length, returns the entire sequence.

func GenerateUID added in v0.12.0

func GenerateUID() types.UID

GenerateUID generates a Unique ID to be used across test cases

func GetImageStreams added in v0.8.0

func GetImageStreams(imageName, namespace, ownerName, imageVersion string) (*v1.ImageStream, *v1.ImageStreamTag)

GetImageStreams creates and gets an ImageStream and its ImageStreamTag for mocking purposes

func HelperLoadBytes added in v0.6.0

func HelperLoadBytes(t *testing.T, name string) []byte

HelperLoadBytes will load, in bytes, the file with the given name in the testdata dir

func NewManager added in v0.9.0

func NewManager() manager.Manager

NewManager ...

func ToRuntimeObjects added in v0.12.0

func ToRuntimeObjects(resources ...resource.KubernetesResource) []runtime.Object

ToRuntimeObjects converts RHSysUtils array KubernetesResource into k8s runtime.Object array

Types

type FakeClientBuilder added in v0.17.0

type FakeClientBuilder interface {
	AddK8sObjects(objects ...runtime.Object) FakeClientBuilder
	AddImageObjects(imageObjs ...runtime.Object) FakeClientBuilder
	AddBuildObjects(buildObjs ...runtime.Object) FakeClientBuilder
	OnOpenShift() FakeClientBuilder
	SupportPrometheus() FakeClientBuilder
	SupportOLM() FakeClientBuilder
	Build() *client.Client
}

FakeClientBuilder create client object for tests

func NewFakeClientBuilder added in v0.17.0

func NewFakeClientBuilder() FakeClientBuilder

NewFakeClientBuilder provides new object FakeClientBuilder to build a FakeClient. Usage: NewFakeClientBuilder().AddK8sObjects(obj1, obj2).Build()

type MockController added in v0.9.0

type MockController interface {
	controller.Controller
	// GetWatchedSources gets all the sources added to the Mock
	GetWatchedSources() []source.Source
}

MockController ...

func NewController added in v0.9.0

func NewController() MockController

NewController ...

Jump to

Keyboard shortcuts

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