e2e

package
v0.0.0-...-8011f81 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodMemory = "1Gi"
	PodCPU    = "0"
)
View Source
const (
	CheckInterval           = 5 * time.Second
	EventPublicationTimeout = time.Minute
)

Variables

View Source
var (
	KubeClientset *kubernetes.Clientset

	CassandraClientset *versioned.Clientset

	UseMockedImage                          bool
	CassandraImageName                      *string
	CassandraBootstrapperImageName          *string
	CassandraSidecarImageName               *string
	CassandraSnapshotImageName              *string
	CassandraInitialDelay                   int32
	CassandraLivenessPeriod                 int32
	CassandraLivenessProbeFailureThreshold  int32
	CassandraLivenessTimeout                int32
	CassandraReadinessPeriod                int32
	CassandraReadinessProbeFailureThreshold int32
	CassandraReadinessTimeout               int32
	NodeStartDuration                       time.Duration
	NodeRestartDuration                     time.Duration
	NodeTerminationDuration                 time.Duration
	Namespace                               string
	MaxCassandraNodesPerNamespace           int
	CassEnv                                 map[string]string
)

Functions

func AClusterName

func AClusterName() string

func ANewRackIsAddedForCluster

func ANewRackIsAddedForCluster(namespace, clusterName string, rack v1alpha1.Rack)

func ARackIsRemovedFromCluster

func ARackIsRemovedFromCluster(namespace, clusterName, rackToRemove string)

func AScheduledSnapshotIsAddedToCluster

func AScheduledSnapshotIsAddedToCluster(namespace, clusterName string, snapshot *v1alpha1.Snapshot)

func AScheduledSnapshotIsChangedForCluster

func AScheduledSnapshotIsChangedForCluster(namespace, clusterName string, snapshot *v1alpha1.Snapshot)

func AScheduledSnapshotIsRemovedFromCluster

func AScheduledSnapshotIsRemovedFromCluster(namespace, clusterName string)

func BeCreatedOnOrAfter

func BeCreatedOnOrAfter(targetTime time.Time) types.GomegaMatcher

BeCreatedOnOrAfter matcher

func BeCreatedWithServiceName

func BeCreatedWithServiceName(expected string) types.GomegaMatcher

BeCreatedWithServiceName matcher

func CassandraDefinitions

func CassandraDefinitions(namespace string) ([]v1alpha1.Cassandra, error)

func CassandraEventsFor

func CassandraEventsFor(namespace, clusterName string) func() ([]coreV1.Event, error)

func CassandraEventsSince

func CassandraEventsSince(namespace, clusterName string, sinceTime time.Time) func() ([]coreV1.Event, error)

func ClusterConfigHashForRack

func ClusterConfigHashForRack(namespace, clusterName, rack string) string

func CronJob

func CronJob(namespace, jobName string) func() (*kubernetesResource, error)

func CronJobIsDeletedSince

func CronJobIsDeletedSince(namespace, jobName string, initialCreationTime time.Time) func() (bool, error)

func CronJobsForCluster

func CronJobsForCluster(namespace, clusterName string) func() ([]*kubernetesResource, error)

func DataCenterForCluster

func DataCenterForCluster(namespace, clusterName string) func() (string, error)

func DefaultJvmOptionsWithLine

func DefaultJvmOptionsWithLine(lineToAppend string) string

func DeleteCassandraResourcesForClusters

func DeleteCassandraResourcesForClusters(namespace string, clusterNames ...string)

func DeleteCassandraResourcesInNamespace

func DeleteCassandraResourcesInNamespace(namespace string)

func DurationSeconds

func DurationSeconds(seconds int32) time.Duration

func Each

func Each(subMatcher types.GomegaMatcher) types.GomegaMatcher

Each matcher

func EventuallyClusterIsCreatedWithRacks

func EventuallyClusterIsCreatedWithRacks(namespace string, clusterName string, racks []v1alpha1.Rack)

func FileExistsInConfigurationDirectory

func FileExistsInConfigurationDirectory(namespace string, podName string, filename string) func() (bool, error)

func GetMetric

func GetMetric(metricGetterFunc func() (string, error), metricToFind string) (int, error)

func HaveAnnotation

func HaveAnnotation(expected interface{}) types.GomegaMatcher

HaveAnnotation matcher

func HaveAnnotationValue

func HaveAnnotationValue(expected interface{}) types.GomegaMatcher

HaveAnnotationValue matcher

func HaveContainer

func HaveContainer(containerName string, expectation ContainerSpecExpectation) types.GomegaMatcher

HaveContainer matcher

func HaveDifferentRevisionTo

func HaveDifferentRevisionTo(rackRevisions map[string]string) types.GomegaMatcher

HaveDifferentRevisionTo matcher

func HaveEmptyDirVolumeMountAtPath

func HaveEmptyDirVolumeMountAtPath(path string) types.GomegaMatcher

HaveEmptyDirVolumeMountAtPath

func HaveEvent

func HaveEvent(expected EventExpectation) types.GomegaMatcher

HaveEvent matcher

func HaveInitContainer

func HaveInitContainer(initContainerName string, expectation ContainerSpecExpectation) types.GomegaMatcher

HaveInitContainer matcher

func HaveJVMArg

func HaveJVMArg(expectedArg string) types.GomegaMatcher

HaveJVMArg matcher

func HaveJobSpec

func HaveJobSpec(expected interface{}) types.GomegaMatcher

HaveJobSpec

func HaveLabel

func HaveLabel(key, value string) types.GomegaMatcher

HaveLabel matcher

func HavePersistentVolumeMountAtPath

func HavePersistentVolumeMountAtPath(path string) types.GomegaMatcher

HavePersistentVolumeMountAtPath

func HaveResourcesRequirements

func HaveResourcesRequirements(expected *ResourceRequirementsAssertion) types.GomegaMatcher

HaveResourcesRequirements matcher

func HaveStorageCapacity

func HaveStorageCapacity(value string) types.GomegaMatcher

HaveStorageCapacity matcher

func HaveVolumeForConfigMap

func HaveVolumeForConfigMap(configMapName string) types.GomegaMatcher

HaveVolumeForConfigMap matcher

func HeadlessServiceForCluster

func HeadlessServiceForCluster(namespace, clusterName string) func() (*kubernetesResource, error)

func Kubectl

func Kubectl(namespace string, args ...string) (*exec.Cmd, []byte, error)

func KubectlOutputAsString

func KubectlOutputAsString(namespace string, args ...string) string

func OperatorMetrics

func OperatorMetrics(namespace string) func() (string, error)

func ParallelTestBeforeSuite

func ParallelTestBeforeSuite(createClustersOnce func() []TestCluster, runOnceOnEachNode func(clusterNames []string)) bool

func PersistentVolumeClaimsForCluster

func PersistentVolumeClaimsForCluster(namespace, clusterName string) func() ([]*kubernetesResource, error)

func PodCreationTime

func PodCreationTime(namespace, podName string) func() (time.Time, error)

func PodName

func PodName(clusterName, rack string, count int) string

func PodReadinessStatus

func PodReadinessStatus(namespace, podName string) func() (bool, error)

func PodReadyForCluster

func PodReadyForCluster(namespace, clusterName string) func() (int, error)

func PodRestartForCluster

func PodRestartForCluster(namespace, clusterName string) func() (int, error)

func PodSpec

func PodSpec() *apis.PodSpecBuilder

func PodsForCluster

func PodsForCluster(namespace, clusterName string) func() ([]*kubernetesResource, error)

func PrintDiagnosis

func PrintDiagnosis(namespace string, testStartTime time.Time, clusterNames ...string)

func Rack

func Rack(rackName string, replicas int32) v1alpha1.Rack

func RackWithEmptyDir

func RackWithEmptyDir(rackName string, replicas int32) v1alpha1.Rack

func RacksForCluster

func RacksForCluster(namespace, clusterName string) func() (map[string][]string, error)

func ReportAClusterWith

func ReportAClusterWith(expected interface{}) types.GomegaMatcher

ReportAClusterWith matcher

func ReportNoClusterMetricsFor

func ReportNoClusterMetricsFor(namespace string, clusterName string) types.GomegaMatcher

ReportNoClusterMetricsFor matcher

func SequentialTestBeforeSuite

func SequentialTestBeforeSuite(runOnce func()) bool

func ServiceIsDeletedSince

func ServiceIsDeletedSince(namespace, serviceName string, initialCreationTime time.Time) func() (bool, error)

func SnapshotConfigFromSchedule

func SnapshotConfigFromSchedule(cron string) *v1alpha1.Snapshot

func SnapshotJobsFor

func SnapshotJobsFor(clusterName string) func() (int, error)

func StatefulSetDeletedSince

func StatefulSetDeletedSince(namespace, statefulSetName string, initialCreationTime time.Time) func() (bool, error)

func StatefulSetForRack

func StatefulSetForRack(namespace, clusterName, rack string) (*kubernetesResource, error)

func StatefulSetRevision

func StatefulSetRevision(namespace, statefulSetName string) (string, error)

func StatefulSetsForCluster

func StatefulSetsForCluster(namespace, clusterName string) func() ([]*kubernetesResource, error)

func TheBootstrapperImageImmutablePropertyIsChangedTo

func TheBootstrapperImageImmutablePropertyIsChangedTo(namespace, clusterName, imageName string)

func TheClusterIsDeleted

func TheClusterIsDeleted(clusterName string)

func TheClusterPodEnvVarsAreChangedTo

func TheClusterPodEnvVarsAreChangedTo(namespace, clusterName string, envVars *[]v1alpha1.CassEnvVar)

func TheClusterPodResourcesSpecAreChangedTo

func TheClusterPodResourcesSpecAreChangedTo(namespace, clusterName string, podResources coreV1.ResourceRequirements)

func TheClusterPodSpecAreChangedTo

func TheClusterPodSpecAreChangedTo(namespace, clusterName string, podSpec v1alpha1.Pod)

func TheCronJobIsDeleted

func TheCronJobIsDeleted(namespace, jobName string)

func TheCronjobResourcesAreChangedTo

func TheCronjobResourcesAreChangedTo(namespace, jobName string, editedResources coreV1.ResourceRequirements)

func TheCustomConfigHashIsChangedForRack

func TheCustomConfigHashIsChangedForRack(namespace, clusterName, rackName string)

func TheCustomConfigIsAddedForCluster

func TheCustomConfigIsAddedForCluster(namespace, clusterName string, extraConfigFile *ExtraConfigFile)

func TheCustomConfigIsDeletedForCluster

func TheCustomConfigIsDeletedForCluster(namespace, clusterName string)

func TheCustomConfigIsModifiedForCluster

func TheCustomConfigIsModifiedForCluster(namespace, clusterName string, extraConfigFile *ExtraConfigFile)

func TheCustomJVMOptionsConfigIsChangedForCluster

func TheCustomJVMOptionsConfigIsChangedForCluster(namespace, clusterName, jvmOptions string)

func TheImageImmutablePropertyIsChangedTo

func TheImageImmutablePropertyIsChangedTo(namespace, clusterName, imageName string)

func TheRackReplicationIsChangedTo

func TheRackReplicationIsChangedTo(namespace, clusterName, rackName string, replicas int)

func TheRackStorageIsChangedTo

func TheRackStorageIsChangedTo(namespace, clusterName, rackName string, storages []v1alpha1.Storage)

func TheServiceIsDeletedFor

func TheServiceIsDeletedFor(namespace, clusterName string)

func TheSnapshotCleanupCronJobIsDeleted

func TheSnapshotCleanupCronJobIsDeleted(namespace, clusterName string)

func TheSnapshotCronJobIsDeleted

func TheSnapshotCronJobIsDeleted(namespace, clusterName string)

func TheStatefulSetContainerEnvVarsHaveChanged

func TheStatefulSetContainerEnvVarsHaveChanged(namespace, statefulSetName string, containerName string, newEnvVars []coreV1.EnvVar)

func TheStatefulSetContainerImageNameIsChanged

func TheStatefulSetContainerImageNameIsChanged(namespace, statefulSetName string, containerName string, newImageName string)

func TheStatefulSetContainerResourcesChanged

func TheStatefulSetContainerResourcesChanged(namespace, statefulSetName string, containerName string, editedResources coreV1.ResourceRequirements)

func TheStatefulSetIsDeletedForRack

func TheStatefulSetIsDeletedForRack(namespace, clusterName, rackName string)

func UniqueNodesUsed

func UniqueNodesUsed(namespace, clusterName string) ([]string, error)

Types

type AnnotationValueAssertion

type AnnotationValueAssertion struct {
	Name  string
	Value string
}

func (AnnotationValueAssertion) String

func (m AnnotationValueAssertion) String() string

type ClusterBuilder

type ClusterBuilder struct {
	// contains filtered or unexported fields
}

func AClusterWithName

func AClusterWithName(clusterName string) *ClusterBuilder

func (*ClusterBuilder) AndClusterSpec

func (c *ClusterBuilder) AndClusterSpec(clusterSpec *v1alpha1.CassandraSpec) *ClusterBuilder

func (*ClusterBuilder) AndCustomConfig

func (c *ClusterBuilder) AndCustomConfig(extraConfigFile *ExtraConfigFile) *ClusterBuilder

func (*ClusterBuilder) AndPodSpec

func (c *ClusterBuilder) AndPodSpec(podSpec *v1alpha1.Pod) *ClusterBuilder

func (*ClusterBuilder) AndRacks

func (c *ClusterBuilder) AndRacks(racks []v1alpha1.Rack) *ClusterBuilder

func (*ClusterBuilder) AndScheduledSnapshot

func (c *ClusterBuilder) AndScheduledSnapshot(snapshot *v1alpha1.Snapshot) *ClusterBuilder

func (*ClusterBuilder) Exists

func (c *ClusterBuilder) Exists() *cluster.Cluster

func (*ClusterBuilder) ForDatacenter

func (c *ClusterBuilder) ForDatacenter(datacenter string) *ClusterBuilder

func (*ClusterBuilder) IsDefined

func (c *ClusterBuilder) IsDefined() *cluster.Cluster

func (*ClusterBuilder) WithoutCustomConfig

func (c *ClusterBuilder) WithoutCustomConfig() *ClusterBuilder

func (*ClusterBuilder) WithoutRacks

func (c *ClusterBuilder) WithoutRacks() *ClusterBuilder

type ContainerEnvExpectation

type ContainerEnvExpectation struct {
	CassEnv map[string]string
}

type ContainerExpectation

type ContainerExpectation struct {
	ImageName                      string
	ContainerPorts                 map[string]int
	MemoryRequest                  string
	MemoryLimit                    string
	CPURequest                     string
	LivenessProbeTimeout           time.Duration
	LivenessProbeFailureThreshold  int32
	LivenessProbePeriod            time.Duration
	LivenessProbeInitialDelay      time.Duration
	ReadinessProbeTimeout          time.Duration
	ReadinessProbeFailureThreshold int32
	ReadinessProbeSuccessThreshold int32
	ReadinessProbePeriod           time.Duration
	ReadinessProbeInitialDelay     time.Duration
	CassEnv                        map[string]string
	LifecyclePreStopCommand        []string
}

type ContainerImageExpectation

type ContainerImageExpectation struct {
	ImageName string
}

type ContainerSpecExpectation

type ContainerSpecExpectation interface {
	// contains filtered or unexported methods
}

type EventExpectation

type EventExpectation struct {
	Type                 string
	Reason               string
	Message              string
	LastTimestampCloseTo *time.Time
}

type ExtraConfigFile

type ExtraConfigFile struct {
	Name    string
	Content string
}

type JobExpectation

type JobExpectation struct {
	Schedule         string
	ContainerImage   string
	ContainerCommand []string
}

type MetricAssertion

type MetricAssertion struct {
	// contains filtered or unexported fields
}

func ClusterSizeMetric

func ClusterSizeMetric(namespace, clusterName string, value uint) MetricAssertion

func DownAndNormalNodeMetric

func DownAndNormalNodeMetric(namespace, clusterName, node string, rack string, value int) MetricAssertion

func FailedValidationMetric

func FailedValidationMetric(namespace, clusterName string, value int) MetricAssertion

func LiveAndNormalNodeMetric

func LiveAndNormalNodeMetric(namespace, clusterName, node string, rack string, value int) MetricAssertion

func (MetricAssertion) String

func (m MetricAssertion) String() string

type MetricsExpectation

type MetricsExpectation struct {
	MetricsToCheck func() []MetricAssertion
}

type PodEventLog

type PodEventLog struct {
	// contains filtered or unexported fields
}

func WatchPodEvents

func WatchPodEvents(namespace, clusterName string) (*PodEventLog, watch.Interface)

func (*PodEventLog) PodsNotDownAtTheSameTime

func (e *PodEventLog) PodsNotDownAtTheSameTime(pod, otherPod string) (bool, error)

The basic idea is to validate no 2 pods were down at the same time. It doesn't matter which pod was first deleted. If a pod was deleted before the other pod, it should have been (re)created before the other pod is deleted. If that's not the case then 2 pods were down at one moment in time, which is the error case.

func (*PodEventLog) PodsStartedEventCount

func (e *PodEventLog) PodsStartedEventCount(pod string) int

type ResourceRequirementsAssertion

type ResourceRequirementsAssertion struct {
	ContainerName                                    string
	MemoryRequest, MemoryLimit, CPULimit, CPURequest *string
}

type TestCluster

type TestCluster struct {
	Name                string
	Racks               []v1alpha1.Rack
	ExtraConfigFileName string
	SnapshotConfig      *v1alpha1.Snapshot
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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