test

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestLogger = logger.GetLogger("test")

TestLogger ...

Functions

func AssertCreate

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

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

func AssertFetchMustExist

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

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

func AssertFetchWithKeyMustExist

func AssertFetchWithKeyMustExist(t *testing.T, client *client.Client, resource kubernetes.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

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

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

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

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 CreateFakeDataIndex

func CreateFakeDataIndex(namespace string) *v1beta1.KogitoSupportingService

CreateFakeDataIndex ...

func CreateFakeExplainabilityService

func CreateFakeExplainabilityService(namespace string) *v1beta1.KogitoSupportingService

CreateFakeExplainabilityService ...

func CreateFakeImageStreams added in v1.8.0

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

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

func CreateFakeJobsService

func CreateFakeJobsService(namespace string) *v1beta1.KogitoSupportingService

CreateFakeJobsService ...

func CreateFakeJobsServiceWithPropertiesConfigMap

func CreateFakeJobsServiceWithPropertiesConfigMap(namespace string, propertiesConfigMapName string) *v1beta1.KogitoSupportingService

CreateFakeJobsServiceWithPropertiesConfigMap ...

func CreateFakeKafka

func CreateFakeKafka(name, namespace string) *v1beta2.Kafka

CreateFakeKafka creates a Kafka resource with default configuration

func CreateFakeKogitoInfinispan

func CreateFakeKogitoInfinispan(namespace string) api.KogitoInfraInterface

CreateFakeKogitoInfinispan create fake kogito infra instance for Infinispan

func CreateFakeKogitoKafka

func CreateFakeKogitoKafka(namespace string) api.KogitoInfraInterface

CreateFakeKogitoKafka create fake kogito infra instance for kafka

func CreateFakeKogitoKnative

func CreateFakeKogitoKnative(namespace string) api.KogitoInfraInterface

CreateFakeKogitoKnative create fake kogito infra instance for Knative

func CreateFakeKogitoRuntime

func CreateFakeKogitoRuntime(namespace string) *v1beta1.KogitoRuntime

CreateFakeKogitoRuntime ...

func CreateFakeMgmtConsole

func CreateFakeMgmtConsole(namespace string) *v1beta1.KogitoSupportingService

CreateFakeMgmtConsole ...

func CreateFakeTaskConsole

func CreateFakeTaskConsole(namespace string) *v1beta1.KogitoSupportingService

CreateFakeTaskConsole ...

func CreateFakeTrustyAIService

func CreateFakeTrustyAIService(namespace string) *v1beta1.KogitoSupportingService

CreateFakeTrustyAIService ...

func CreateFakeTrustyUIService

func CreateFakeTrustyUIService(namespace string) *v1beta1.KogitoSupportingService

CreateFakeTrustyUIService ...

func GenerateShortUID

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

func GenerateUID() types.UID

GenerateUID generates a Unique ID to be used across test cases

func HelperLoadBytes

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

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

func SetSharedEnv added in v1.8.0

func SetSharedEnv(k, v string) (deferFunc func())

SetSharedEnv sets a value to a given Environment variable returns the defer function that MUST be called after your test to not mess up with users' env

func ToRuntimeObjects

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

ToRuntimeObjects converts RHSysUtils array KubernetesResource into k8s runtime.Object array

Types

type FakeClientBuilder

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

func NewFakeClientBuilder() FakeClientBuilder

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

Jump to

Keyboard shortcuts

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