Skip to content

Commit

Permalink
Add e2e test for Medusa against DSE
Browse files Browse the repository at this point in the history
  • Loading branch information
adejanovski committed Sep 20, 2023
1 parent 6154bc3 commit c3a10a4
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/kind_e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
- CreateSingleReaper
- CreateReaperAndDatacenter
- CreateSingleMedusaJob
- CreateSingleDseMedusaJob
- ConfigControllerRestarts
# TODO: these e2e tests started breaking after new client certificates were added. Needs fixing.
#- SingleDcEncryptionWithStargate
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG/CHANGELOG-1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ When cutting a new release, update the `unreleased` heading to the tag being gen
* [BUGFIX] [#1017](https://github.com/k8ssandra/k8ssandra-operator/issues/1017) Fix MedusaTask to delete only its own backups
* [DOCS] [#1019](https://github.com/k8ssandra/k8ssandra-operator/issues/1019) Add PR review guidelines documentation
* [TESTING] [#1037](https://github.com/k8ssandra/k8ssandra-operator/issues/1037) Add non regression test for Medusa issue with scale up after a restore
* [TESTING] [#1037](https://github.com/k8ssandra/k8ssandra-operator/issues/1037) Add e2e test for Medusa against DSE
19 changes: 11 additions & 8 deletions test/e2e/medusa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ func createSingleMedusaJob(t *testing.T, ctx context.Context, namespace string,
verifyRestoreJobFinished(t, ctx, f, dcKey, backupKey)

// Scale the cluster to verify that the previous restore won't break the new pod
t.Log("Scaling the cluster to 3 nodes")
err = f.Get(ctx, kcKey, kc)
require.NoError(err, "Error getting the K8ssandraCluster")
kcPatch := client.MergeFromWithOptions(kc.DeepCopy(), client.MergeFromWithOptimisticLock{})
kc.Spec.Cassandra.Datacenters[0].Size = 3
err = f.Client.Patch(ctx, kc, kcPatch)
require.NoError(err, "Error scaling the cluster")
checkDatacenterReady(t, ctx, dcKey, f)
// Not doing this for DSE tests as it takes too long
if kc.Spec.Cassandra.ServerType == "cassandra" {
t.Log("Scaling the cluster to 3 nodes")
err = f.Get(ctx, kcKey, kc)
require.NoError(err, "Error getting the K8ssandraCluster")
kcPatch := client.MergeFromWithOptions(kc.DeepCopy(), client.MergeFromWithOptimisticLock{})
kc.Spec.Cassandra.Datacenters[0].Size = 3
err = f.Client.Patch(ctx, kc, kcPatch)
require.NoError(err, "Error scaling the cluster")
checkDatacenterReady(t, ctx, dcKey, f)
}
}

func createMultiMedusaJob(t *testing.T, ctx context.Context, namespace string, f *framework.E2eFramework) {
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ func TestOperator(t *testing.T) {
doCassandraDatacenterCleanup: false,
installMinio: true,
}))
t.Run("CreateSingleDseMedusaJob", e2eTest(ctx, &e2eTestOpts{
testFunc: createSingleMedusaJob,
fixture: framework.NewTestFixture("single-dc-dse-medusa", controlPlane),
skipK8ssandraClusterCleanup: false,
doCassandraDatacenterCleanup: false,
installMinio: true,
}))
t.Run("CreateMultiMedusaJob", e2eTest(ctx, &e2eTestOpts{
testFunc: createMultiMedusaJob,
fixture: framework.NewTestFixture("multi-dc-encryption-medusa", controlPlane),
Expand Down Expand Up @@ -680,7 +687,7 @@ func applyPollingDefaults() {
polling.reaperReady.timeout = 10 * time.Minute
polling.reaperReady.interval = 15 * time.Second

polling.medusaBackupDone.timeout = 2 * time.Minute
polling.medusaBackupDone.timeout = 5 * time.Minute
polling.medusaBackupDone.interval = 5 * time.Second

polling.medusaRestoreDone.timeout = 10 * time.Minute
Expand Down
35 changes: 35 additions & 0 deletions test/testdata/fixtures/single-dc-dse-medusa/k8ssandra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: k8ssandra.io/v1alpha1
kind: K8ssandraCluster
metadata:
name: test
spec:
medusa:
storageProperties:
storageProvider: s3_compatible
bucketName: k8ssandra-medusa
prefix: test
storageSecretRef:
name: medusa-bucket-key
host: minio-service.minio.svc.cluster.local
port: 9000
secure: false
cassandra:
clusterName: "First Cluster"
serverVersion: 6.8.36
serverType: dse
datacenters:
- metadata:
name: dc1
k8sContext: kind-k8ssandra-0
size: 2
storageConfig:
cassandraDataVolumeClaimSpec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
config:
jvmOptions:
heapSize: 512Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- k8ssandra.yaml

0 comments on commit c3a10a4

Please sign in to comment.