test

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 33 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 *kogitocli.Client, resource client.Object)

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

func AssertFetchMustExist

func AssertFetchMustExist(t *testing.T, client *kogitocli.Client, resource client.Object)

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

func AssertFetchWithKeyMustExist

func AssertFetchWithKeyMustExist(t *testing.T, client *kogitocli.Client, resource client.Object, 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 client.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 client.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 client.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) *kogitocli.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) *kogitocli.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 CreateFakeInfinispan added in v1.12.0

func CreateFakeInfinispan(namespace string) *infinispan.Infinispan

CreateFakeInfinispan ...

func CreateFakeInfinispanCertSecret added in v1.12.0

func CreateFakeInfinispanCertSecret(namespace string) (*v13.Secret, error)

CreateFakeInfinispanCertSecret ...

func CreateFakeInfinispanCredentialSecret added in v1.12.0

func CreateFakeInfinispanCredentialSecret(namespace string) *v13.Secret

CreateFakeInfinispanCredentialSecret ...

func CreateFakeInfinispanService added in v1.12.0

func CreateFakeInfinispanService(namespace string) *v13.Service

CreateFakeInfinispanService ...

func CreateFakeJobsService

func CreateFakeJobsService(namespace string) *v1beta1.KogitoSupportingService

CreateFakeJobsService ...

func CreateFakeKafka

func CreateFakeKafka(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 CreateFakeKogitoKafkaConfig added in v1.12.0

func CreateFakeKogitoKafkaConfig(namespace string) *v12.ConfigMap

CreateFakeKogitoKafkaConfig ...

func CreateFakeKogitoKnative

func CreateFakeKogitoKnative(namespace string) api.KogitoInfraInterface

CreateFakeKogitoKnative create fake kogito infra instance for Knative

func CreateFakeKogitoMongoDB added in v1.12.0

func CreateFakeKogitoMongoDB(namespace string) api.KogitoInfraInterface

CreateFakeKogitoMongoDB create fake kogito infra instance for MongoDB

func CreateFakeKogitoRuntime

func CreateFakeKogitoRuntime(namespace string) *v1beta1.KogitoRuntime

CreateFakeKogitoRuntime ...

func CreateFakeMgmtConsole

func CreateFakeMgmtConsole(namespace string) *v1beta1.KogitoSupportingService

CreateFakeMgmtConsole ...

func CreateFakeMongoDB added in v1.12.0

func CreateFakeMongoDB(namespace string) *mongodb.MongoDBCommunity

CreateFakeMongoDB ...

func CreateFakeMongoDBSecret added in v1.12.0

func CreateFakeMongoDBSecret(namespace string) *v1.Secret

CreateFakeMongoDBSecret ...

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 ...client.Object) []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() *kogitocli.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