framework

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Client client.Client
)

Functions

func CleanupForKubernetes

func CleanupForKubernetes(input string) string

func Init

func Init(t *testing.T)

Types

type ClusterKey

type ClusterKey struct {
	types.NamespacedName

	K8sContext string
}

func (ClusterKey) String

func (k ClusterKey) String() string

type E2eFramework

type E2eFramework struct {
	*Framework
	// contains filtered or unexported fields
}

func NewE2eFramework

func NewE2eFramework(t *testing.T) (*E2eFramework, error)

func (*E2eFramework) CreateCassandraEncryptionStoresSecret

func (f *E2eFramework) CreateCassandraEncryptionStoresSecret(namespace string) error

func (*E2eFramework) DeleteDatacenters

func (f *E2eFramework) DeleteDatacenters(namespace string, timeout, interval time.Duration) error

DeleteDatacenters deletes all CassandraDatacenters in namespace in all remote clusters. This function blocks until all pods from all CassandraDatacenters have terminated.

func (*E2eFramework) DeleteK8ssandraOperatorPods

func (f *E2eFramework) DeleteK8ssandraOperatorPods(namespace string, timeout, interval time.Duration) error

func (*E2eFramework) DeleteNamespace

func (f *E2eFramework) DeleteNamespace(name string, timeout, interval time.Duration) error

DeleteNamespace Deletes the namespace from all remote clusters and blocks until they have completely terminated.

func (*E2eFramework) DeleteReapers

func (f *E2eFramework) DeleteReapers(namespace string, timeout, interval time.Duration) error

DeleteReapers deletes all Reapers in namespace in all remote clusters. This function blocks until all pods from all Reapers have terminated.

func (*E2eFramework) DeleteReplicatedSecrets

func (f *E2eFramework) DeleteReplicatedSecrets(namespace string, timeout, interval time.Duration) error

DeleteReplicatedSecrets deletes all the ReplicatedSecrets in the namespace. This causes some delay while secret controller removes the finalizers and clears the replicated secrets from remote clusters.

func (*E2eFramework) DeleteStargates

func (f *E2eFramework) DeleteStargates(namespace string, timeout, interval time.Duration) error

DeleteStargates deletes all Stargates in namespace in all remote clusters. This function blocks until all pods from all Stargates have terminated.

func (*E2eFramework) DeployCassandraConfigMap

func (f *E2eFramework) DeployCassandraConfigMap(namespace string) error

func (*E2eFramework) DeployCertManager

func (f *E2eFramework) DeployCertManager() error

func (*E2eFramework) DeployK8sClientConfigs

func (f *E2eFramework) DeployK8sClientConfigs(namespace string) error

func (*E2eFramework) DeployK8sContextsSecret

func (f *E2eFramework) DeployK8sContextsSecret(namespace string) error

DeployK8sContextsSecret Deploys the contexts secret in the control plane cluster.

func (*E2eFramework) DeployK8ssandraOperator

func (f *E2eFramework) DeployK8ssandraOperator(config OperatorDeploymentConfig) error

DeployK8ssandraOperator deploys k8ssandra-operator both in the control plane cluster and in the data plane cluster(s). Note that the control plane cluster can also be one of the data plane clusters. It then deploys the operator in the data plane clusters with the K8ssandraCluster controller disabled. When clusterScoped is true the operator is configured to watch all namespaces and is deployed in the k8ssandra-operator namespace.

func (*E2eFramework) DeployReaperIngresses

func (f *E2eFramework) DeployReaperIngresses(t *testing.T, ctx context.Context, k8sContext string, k8sContextIdx int, namespace, reaperServiceName string)

func (*E2eFramework) DeployStargateIngresses

func (f *E2eFramework) DeployStargateIngresses(t *testing.T, k8sContext string, k8sContextIdx int, namespace, stargateServiceName, username, password string)

func (*E2eFramework) DeployTraefik

func (f *E2eFramework) DeployTraefik(t *testing.T, namespace string) error

func (*E2eFramework) DumpClusterInfo

func (f *E2eFramework) DumpClusterInfo(test string, namespaces ...string) error

DumpClusterInfo Executes `kubectl cluster-info dump -o yaml` on each cluster. The output is stored under <project-root>/build/test.

func (*E2eFramework) ExecuteCql

func (f *E2eFramework) ExecuteCql(ctx context.Context, k8sContext, namespace, clusterName, pod, query string) (string, error)

func (*E2eFramework) GetNodeToolStatusUN

func (f *E2eFramework) GetNodeToolStatusUN(k8sContext, namespace, pod string, additionalArgs ...string) (int, error)

GetNodeToolStatusUN Executes nodetool status against the Cassandra pod and returns a count of the matching lines reporting a status of Up/Normal.

func (*E2eFramework) GetPodIP

func (f *E2eFramework) GetPodIP(k8sContext, namespace, pod string) (string, error)

func (*E2eFramework) RetrieveDatabaseCredentials

func (f *E2eFramework) RetrieveDatabaseCredentials(ctx context.Context, namespace, clusterName string) (string, string, error)

func (*E2eFramework) RetrieveSuperuserSecret

func (f *E2eFramework) RetrieveSuperuserSecret(ctx context.Context, namespace, clusterName string) (*corev1.Secret, error)

func (*E2eFramework) UndeployAllIngresses

func (f *E2eFramework) UndeployAllIngresses(t *testing.T, k8sContext, namespace string)

func (*E2eFramework) UndeployK8ssandraOperator

func (f *E2eFramework) UndeployK8ssandraOperator(namespace string) error

func (*E2eFramework) UndeployTraefik

func (f *E2eFramework) UndeployTraefik(t *testing.T, namespace string) error

func (*E2eFramework) WaitForCassOperatorToBeReady

func (f *E2eFramework) WaitForCassOperatorToBeReady(namespace string, timeout, interval time.Duration) error

WaitForCassOperatorToBeReady blocks until the cass-operator deployment is ready in all clusters.

func (*E2eFramework) WaitForCertManagerToBeReady

func (f *E2eFramework) WaitForCertManagerToBeReady(namespace string, timeout, interval time.Duration) error

func (*E2eFramework) WaitForCrdsToBecomeActive

func (f *E2eFramework) WaitForCrdsToBecomeActive() error

func (*E2eFramework) WaitForK8ssandraOperatorToBeReady

func (f *E2eFramework) WaitForK8ssandraOperatorToBeReady(namespace string, timeout, interval time.Duration) error

WaitForK8ssandraOperatorToBeReady blocks until the k8ssandra-operator deployment is ready in the control plane cluster.

type Framework

type Framework struct {
	// Client is the client for the control plane cluster, i.e., the cluster in which the
	// K8ssandraCluster controller is deployed. Note that this may also be one of the
	// remote clusters.
	Client client.Client

	// The Kubernetes context in which the K8ssandraCluser controller is running.
	ControlPlaneContext string
	// contains filtered or unexported fields
}

Framework provides methods for use in both integration and e2e tests.

func NewFramework

func NewFramework(client client.Client, controlPlanContext string, remoteClients map[string]client.Client) *Framework

func (*Framework) AssertObjectDoesNotExist

func (f *Framework) AssertObjectDoesNotExist(ctx context.Context, t *testing.T, key ClusterKey, obj client.Object, timeout, interval time.Duration)

func (*Framework) ContainerHasEnvVar

func (f *Framework) ContainerHasEnvVar(container corev1.Container, envVarName, envVarValue string) bool

func (*Framework) ContainerHasVolumeMount

func (f *Framework) ContainerHasVolumeMount(container corev1.Container, volumeName, volumePath string) bool

func (*Framework) Create

func (f *Framework) Create(ctx context.Context, key ClusterKey, obj client.Object) error

func (*Framework) CreateNamespace

func (f *Framework) CreateNamespace(name string) error

func (*Framework) DatacenterExists

func (f *Framework) DatacenterExists(ctx context.Context, key ClusterKey) func() bool

func (*Framework) Delete

func (f *Framework) Delete(ctx context.Context, key ClusterKey, obj client.Object) error

func (*Framework) DeleteCassandraDatacenters

func (f *Framework) DeleteCassandraDatacenters(namespace string, interval, timeout time.Duration) error

func (*Framework) DeleteK8ssandraCluster

func (f *Framework) DeleteK8ssandraCluster(ctx context.Context, key client.ObjectKey) error

func (*Framework) DeleteK8ssandraClusters

func (f *Framework) DeleteK8ssandraClusters(namespace string, interval, timeout time.Duration) error

func (*Framework) Get

func (f *Framework) Get(ctx context.Context, key ClusterKey, obj client.Object) error

Get fetches the object specified by key from the cluster specified by key. An error is returned is ClusterKey.K8sContext is not set or if there is no corresponding client.

func (*Framework) List

func (f *Framework) List(ctx context.Context, key ClusterKey, obj client.ObjectList, opts ...client.ListOption) error

func (*Framework) NewWithDatacenter

func (f *Framework) NewWithDatacenter(ctx context.Context, key ClusterKey) func(func(*cassdcapi.CassandraDatacenter) bool) func() bool

NewWithDatacenter is a function generator for withDatacenter that is bound to ctx, and key.

func (*Framework) NewWithReaper

func (f *Framework) NewWithReaper(ctx context.Context, key ClusterKey) func(func(reaper *reaperapi.Reaper) bool) func() bool

NewWithReaper is a function generator for withReaper that is bound to ctx, and key.

func (*Framework) NewWithStargate

func (f *Framework) NewWithStargate(ctx context.Context, key ClusterKey) func(func(stargate *stargateapi.Stargate) bool) func() bool

NewWithStargate is a function generator for withStargate that is bound to ctx, and key.

func (*Framework) Patch

func (f *Framework) Patch(ctx context.Context, obj client.Object, patch client.Patch, key ClusterKey, opts ...client.PatchOption) error

func (*Framework) PatchDatacenterStatus

func (f *Framework) PatchDatacenterStatus(ctx context.Context, key ClusterKey, updateFn func(dc *cassdcapi.CassandraDatacenter)) error

PatchDatacenterStatus fetches the datacenter specified by key, applies changes via updateFn, and then performs a patch operation. key.K8sContext must be set and must have a corresponding client.

func (*Framework) PatchReaperStatus

func (f *Framework) PatchReaperStatus(ctx context.Context, key ClusterKey, updateFn func(r *reaperapi.Reaper)) error

func (*Framework) PatchStargateStatus

func (f *Framework) PatchStargateStatus(ctx context.Context, key ClusterKey, updateFn func(sg *stargateapi.Stargate)) error

func (*Framework) ReaperExists

func (f *Framework) ReaperExists(ctx context.Context, key ClusterKey) func() bool

func (*Framework) SetDatacenterStatusReady

func (f *Framework) SetDatacenterStatusReady(ctx context.Context, key ClusterKey) error

SetDatacenterStatusReady fetches the CassandraDatacenter specified by key and persists a status update to make the CassandraDatacenter ready. It sets the DatacenterReady and DatacenterInitialized conditions to true.

func (*Framework) SetReaperStatusReady

func (f *Framework) SetReaperStatusReady(ctx context.Context, key ClusterKey) error

func (*Framework) SetStargateStatusReady

func (f *Framework) SetStargateStatusReady(ctx context.Context, key ClusterKey) error

func (*Framework) StargateExists

func (f *Framework) StargateExists(ctx context.Context, key ClusterKey) func() bool

func (*Framework) Update

func (f *Framework) Update(ctx context.Context, key ClusterKey, obj client.Object) error

func (*Framework) UpdateStatus

func (f *Framework) UpdateStatus(ctx context.Context, key ClusterKey, obj client.Object) error

func (*Framework) WaitForDeploymentToBeReady

func (f *Framework) WaitForDeploymentToBeReady(key ClusterKey, timeout, interval time.Duration) error

WaitForDeploymentToBeReady Blocks until the Deployment is ready. If ClusterKey.K8sContext is empty, this method blocks until the deployment is ready in all remote clusters.

type Kustomization

type Kustomization struct {
	Namespace string

	ImageTag string
}

type OperatorDeploymentConfig

type OperatorDeploymentConfig struct {
	Namespace     string
	ClusterScoped bool
	ImageTag      string
}

Jump to

Keyboard shortcuts

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