framework

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Client client.Client
)

Functions

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() (*E2eFramework, 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) 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) DeployCassOperator

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

DeployCassOperator deploys cass-operator in all remote clusters.

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(namespace string) error

DeployK8ssandraOperator Deploys k8ssandra-operator in the control plane cluster. 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.

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) DumpCassandraLogs

func (f *E2eFramework) DumpCassandraLogs(namespace string)

func (*E2eFramework) DumpClusterInfo

func (f *E2eFramework) DumpClusterInfo(test, namespace string) error

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

func (*E2eFramework) DumpOperatorLogs

func (f *E2eFramework) DumpOperatorLogs(namespace string)

func (*E2eFramework) DumpStargateLogs

func (f *E2eFramework) DumpStargateLogs(namespace string)

func (*E2eFramework) GetNodeToolStatusUN

func (f *E2eFramework) GetNodeToolStatusUN(opts kubectl.Options, pod 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) UndeployK8ssandraOperator

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

func (*E2eFramework) UndeployStargateIngresses

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

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.

func (*E2eFramework) WaitForNodeToolStatusUN

func (f *E2eFramework) WaitForNodeToolStatusUN(opts kubectl.Options, pod string, count int, timeout, interval time.Duration) error

WaitForNodeToolStatusUN polls until nodetool status reports UN for count nodes.

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) CreateNamespace

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

func (*Framework) DatacenterExists

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

func (*Framework) DeleteK8ssandraClusters

func (f *Framework) DeleteK8ssandraClusters(namespace string) 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) 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) NewWithStargate

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

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

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) PatchStagateStatus

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

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.

func (*Framework) StargateExists

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

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
}

Jump to

Keyboard shortcuts

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