cluster

package
v1.30.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package cluster provides Ginkgo/Gomega assertions that operate on a Cluster resource as a whole: create it, observe its readiness, force switchovers, count its PVCs, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertClusterDefault

func AssertClusterDefault(
	env *environment.TestingEnvironment,
	namespace, clusterName string,
)

AssertClusterDefault validates that the cluster object survives the CustomValidator without complaint, i.e. defaults are properly populated.

func AssertClusterEventuallyReachesPhase

func AssertClusterEventuallyReachesPhase(
	env *environment.TestingEnvironment,
	namespace, clusterName string,
	phase []string,
	timeout int,
)

AssertClusterEventuallyReachesPhase checks the phase of a cluster reaches one of the listed phases within the specified timeout.

func AssertClusterIsReady

func AssertClusterIsReady(
	env *environment.TestingEnvironment,
	namespace, clusterName string,
	timeout int,
)

AssertClusterIsReady checks the cluster has as many pods as in spec, that none of them are going to be deleted, and that the status is Healthy.

func AssertClusterPhaseIsConsistent

func AssertClusterPhaseIsConsistent(
	env *environment.TestingEnvironment,
	namespace, clusterName string,
	phase []string,
	timeout int,
)

AssertClusterPhaseIsConsistent expects the phase of a cluster to be consistent for a given number of seconds.

func AssertClusterReadinessStatusIsReached

func AssertClusterReadinessStatusIsReached(
	env *environment.TestingEnvironment,
	namespace, clusterName string,
	conditionStatus apiv1.ConditionStatus,
	timeout int,
)

AssertClusterReadinessStatusIsReached waits until the cluster's ConditionClusterReady condition reaches the provided status.

func AssertCreateCluster

func AssertCreateCluster(
	env *environment.TestingEnvironment,
	testTimeouts map[timeouts.Timeout]int,
	namespace, clusterName, sampleFile string,
)

AssertCreateCluster creates the cluster from a sample file and verifies that the ready pods correspond to the number of Instances in the cluster spec. Important: this is not equivalent to "kubectl apply", and is not able to apply a patch to an existing object.

func AssertNewPrimary

func AssertNewPrimary(env *environment.TestingEnvironment, namespace, clusterName, oldPrimary string)

AssertNewPrimary verifies that a new primary was elected and that it accepts writes.

func AssertPVCCount

func AssertPVCCount(
	env *environment.TestingEnvironment,
	namespace, clusterName string,
	pvcCount, timeout int,
)

AssertPVCCount checks that the cluster status reports the expected PVCCount and that the PVC list in the namespace also matches that count.

func AssertPrimaryUpdateMethod

func AssertPrimaryUpdateMethod(
	env *environment.TestingEnvironment,
	namespace, clusterName string,
	oldPrimaryPod *corev1.Pod,
	primaryUpdateMethod apiv1.PrimaryUpdateMethod,
)

AssertPrimaryUpdateMethod verifies that the -rw endpoint points to the expected primary, and checks if the new primary is the same as before (Restart) or has changed (Switchover).

func AssertSwitchover

func AssertSwitchover(
	env *environment.TestingEnvironment,
	testTimeouts map[timeouts.Timeout]int,
	namespace, clusterName string,
)

AssertSwitchover forces a switchover from the current primary to the second pod by name, and waits for the cluster to converge.

func AssertSwitchoverOnReplica

func AssertSwitchoverOnReplica(
	env *environment.TestingEnvironment,
	testTimeouts map[timeouts.Timeout]int,
	namespace, clusterName string,
)

AssertSwitchoverOnReplica is the replica-cluster variant of AssertSwitchover: it expects the same switchover behaviour but does not require a new timeline (history file) to appear.

Types

This section is empty.

Jump to

Keyboard shortcuts

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