helpers

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestHelper

type TestHelper struct {
	*base.TestHelper
}

TestHelper is a collection of helpers for testing operators. It extends the generic TestHelper from modules/test.

func NewTestHelper

func NewTestHelper(
	ctx context.Context,
	k8sClient client.Client,
	timeout time.Duration,
	interval time.Duration,
	logger logr.Logger,
) *TestHelper

NewTestHelper returns a TestHelper

func (*TestHelper) AssertCertDoesNotExist added in v0.2.0

func (tc *TestHelper) AssertCertDoesNotExist(name types.NamespacedName)

AssertCertDoesNotExist ensures the Certificate resource does not exist in a k8s cluster.

func (*TestHelper) AssertIssuerDoesNotExist added in v0.2.0

func (tc *TestHelper) AssertIssuerDoesNotExist(name types.NamespacedName)

AssertIssuerDoesNotExist ensures the Issuer resource does not exist in a k8s cluster.

func (*TestHelper) AssertMariaDBDatabaseDoesNotExist

func (tc *TestHelper) AssertMariaDBDatabaseDoesNotExist(name types.NamespacedName)

AssertMariaDBDatabaseDoesNotExist ensures the MariaDBDatabase resource does not exist in a k8s cluster.

func (*TestHelper) AssertTransportURLDoesNotExist

func (tc *TestHelper) AssertTransportURLDoesNotExist(name types.NamespacedName)

AssertTransportURLDoesNotExist ensures the TransportURL resource does not exist in a k8s cluster.

func (*TestHelper) CreateDBService

func (tc *TestHelper) CreateDBService(namespace string, mariadbCRName string, spec corev1.ServiceSpec) types.NamespacedName

CreateDBService creates a k8s Service object that matches with the Expectations of lib-common database module as a Service for the MariaDB

func (*TestHelper) CreateMemcached

func (tc *TestHelper) CreateMemcached(namespace string, memcachedName string, spec memcachedv1.MemcachedSpec) types.NamespacedName

CreateMemcached creates a new Memcached instance with the specified namespace in the Kubernetes cluster.

func (*TestHelper) DeleteDBService

func (tc *TestHelper) DeleteDBService(name types.NamespacedName)

DeleteDBService The function deletes the Service if exists and wait for it to disappear from the API. If the Service does not exists then it is assumed to be successfully deleted. Example:

th.DeleteDBService(types.NamespacedName{Name: "my-service", Namespace: "my-namespace"})

or:

DeferCleanup(th.DeleteDBService, th.CreateDBService(cell0.MariaDBDatabaseName.Namespace, cell0.MariaDBDatabaseName.Name, serviceSpec))

func (*TestHelper) DeleteMemcached

func (tc *TestHelper) DeleteMemcached(name types.NamespacedName)

DeleteMemcached deletes a Memcached instance from the Kubernetes cluster.

func (*TestHelper) GetCert added in v0.2.0

GetCert waits for and retrieves a Certificate resource from the Kubernetes cluster

Example:

cert := th.GetCert(types.NamespacedName{Name: "my-issuer", Namespace: "my-namespace"})

func (*TestHelper) GetIssuer added in v0.2.0

func (tc *TestHelper) GetIssuer(name types.NamespacedName) *certmgrv1.Issuer

GetIssuer waits for and retrieves a Issuer resource from the Kubernetes cluster

Example:

issuer := th.GetIssuer(types.NamespacedName{Name: "my-issuer", Namespace: "my-namespace"})

func (*TestHelper) GetMariaDBDatabase

func (tc *TestHelper) GetMariaDBDatabase(name types.NamespacedName) *mariadbv1.MariaDBDatabase

GetMariaDBDatabase waits for and retrieves a MariaDBDatabase resource from the Kubernetes cluster

Example:

mariadbDatabase := th.GetMariaDBDatabase(types.NamespacedName{Name: "my-mariadb-database", Namespace: "my-namespace"})

func (*TestHelper) GetMemcached

func (tc *TestHelper) GetMemcached(name types.NamespacedName) *memcachedv1.Memcached

GetMemcached waits for and retrieves a Memcached instance from the Kubernetes cluster

func (*TestHelper) GetTransportURL

func (tc *TestHelper) GetTransportURL(name types.NamespacedName) *rabbitmqv1.TransportURL

GetTransportURL retrieves a TransportURL resource with the specified name.

Example usage:

th.GetTransportURL(types.NamespacedName{Name: "test-transporturl", Namespace: "test-namespace"})

func (*TestHelper) SimulateMariaDBDatabaseCompleted

func (tc *TestHelper) SimulateMariaDBDatabaseCompleted(name types.NamespacedName)

SimulateMariaDBDatabaseCompleted simulates a completed state for a MariaDBDatabase resource in a Kubernetes cluster.

Example:

th.SimulateMariaDBDatabaseCompleted(types.NamespacedName{Name: "my-mariadb-database", Namespace: "my-namespace"})

or

DeferCleanup(th.SimulateMariaDBDatabaseCompleted, types.NamespacedName{Name: "my-mariadb-database", Namespace: "my-namespace"})

func (*TestHelper) SimulateMemcachedReady

func (tc *TestHelper) SimulateMemcachedReady(name types.NamespacedName)

SimulateMemcachedReady simulates a ready state for a Memcached instance in a Kubernetes cluster.

func (*TestHelper) SimulateTransportURLReady

func (tc *TestHelper) SimulateTransportURLReady(name types.NamespacedName)

SimulateTransportURLReady function retrieves the TransportURL and simulates the readiness of a TransportURL resource.

Example usage:

th.SimulateTransportURLReady(types.NamespacedName{Name: "test-transporturl", Namespace: "test-namespace"})

Jump to

Keyboard shortcuts

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