From 1b4961e4dba589d003cc149580ce6e8ebbf10c8a Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Mon, 16 Oct 2023 14:14:02 +0300 Subject: [PATCH] Add rebuild task to the decommission_dc e2e test --- tests/decommission_dc/decommission_dc_suite_test.go | 10 ++++++++++ tests/node_move/node_move_suite_test.go | 5 +++-- tests/testdata/tasks/rebuild_task.yaml | 13 +++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/testdata/tasks/rebuild_task.yaml diff --git a/tests/decommission_dc/decommission_dc_suite_test.go b/tests/decommission_dc/decommission_dc_suite_test.go index 2d2db0c5..a3be6fc6 100644 --- a/tests/decommission_dc/decommission_dc_suite_test.go +++ b/tests/decommission_dc/decommission_dc_suite_test.go @@ -27,6 +27,7 @@ var ( dc1Label = fmt.Sprintf("cassandra.datastax.com/datacenter=%s", api.CleanupForKubernetes(dc1OverrideName)) dc2Label = fmt.Sprintf("cassandra.datastax.com/datacenter=%s", dc2Name) seedLabel = "cassandra.datastax.com/seed-node=true" + taskYaml = "../testdata/tasks/rebuild_dc_task.yaml" // dcLabel = fmt.Sprintf("cassandra.datastax.com/datacenter=%s", dcName) ns = ginkgo_util.NewWrapper(testName, namespace) ) @@ -127,6 +128,15 @@ var _ = Describe(testName, func() { ns.ExpectDoneReconciling(dc1Name) ns.ExpectDoneReconciling(dc2Name) + // Create a CassandraTask to rebuild dc2 from dc1 + // Create CassandraTask that should replace a node + step = "creating a cassandra rebuild dc2" + k = kubectl.ApplyFiles(taskYaml) + ns.ExecAndLog(step, k) + + // Wait for the task to be completed + ns.WaitForCompleteTask("rebuild-dc") + podNames := ns.GetDatacenterReadyPodNames(dc1OverrideName) Expect(len(podNames)).To(Equal(2)) dcs := findDatacenters(podNames[0]) diff --git a/tests/node_move/node_move_suite_test.go b/tests/node_move/node_move_suite_test.go index 2d79627d..3ad10916 100644 --- a/tests/node_move/node_move_suite_test.go +++ b/tests/node_move/node_move_suite_test.go @@ -5,9 +5,10 @@ package node_move import ( "fmt" + "testing" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "testing" "github.com/k8ssandra/cass-operator/tests/kustomize" ginkgo_util "github.com/k8ssandra/cass-operator/tests/util/ginkgo" @@ -60,7 +61,7 @@ var _ = Describe(testName, func() { }) Specify("the operator can move a cassandra node to a new token", func() { - // Create CassandraTask that should replace a node + // Create CassandraTask that should move tokens step := "creating a cassandra task to move a node" k := kubectl.ApplyFiles(taskYaml) ns.ExecAndLog(step, k) diff --git a/tests/testdata/tasks/rebuild_task.yaml b/tests/testdata/tasks/rebuild_task.yaml new file mode 100644 index 00000000..3ef55b5a --- /dev/null +++ b/tests/testdata/tasks/rebuild_task.yaml @@ -0,0 +1,13 @@ +apiVersion: control.k8ssandra.io/v1alpha1 +kind: CassandraTask +metadata: + name: rebuild-dc +spec: + datacenter: + name: dc2 + namespace: test-decommission-dc + jobs: + - name: rebuild-dc2 + command: rebuild + args: + datacenter: dc1