diff --git a/test/e2e/set/scyllacluster/scyllacluster_scaling.go b/test/e2e/set/scyllacluster/scyllacluster_scaling.go index 4bfdda8ce30..1577702e424 100644 --- a/test/e2e/set/scyllacluster/scyllacluster_scaling.go +++ b/test/e2e/set/scyllacluster/scyllacluster_scaling.go @@ -83,41 +83,9 @@ var _ = g.Describe("ScyllaCluster", func() { verifyCQLData(ctx, diRF3) - framework.By("Scaling the ScyllaCluster down to 4 replicas") - sc, err = f.ScyllaClient().ScyllaV1().ScyllaClusters(sc.Namespace).Patch( - ctx, - sc.Name, - types.JSONPatchType, - []byte(`[{"op": "replace", "path": "/spec/datacenter/racks/0/members", "value": 4}]`), - metav1.PatchOptions{}, - ) - o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(sc.Spec.Datacenter.Racks[0].Members).To(o.BeEquivalentTo(4)) - - framework.By("Waiting for the ScyllaCluster to roll out (RV=%s)", sc.ResourceVersion) - waitCtx3, waitCtx3Cancel := utils.ContextForRollout(ctx, sc) - defer waitCtx3Cancel() - sc, err = controllerhelpers.WaitForScyllaClusterState(waitCtx3, f.ScyllaClient().ScyllaV1().ScyllaClusters(sc.Namespace), sc.Name, controllerhelpers.WaitForStateOptions{}, utils.IsScyllaClusterRolledOut) - o.Expect(err).NotTo(o.HaveOccurred()) - - verifyScyllaCluster(ctx, f.KubeClient(), sc) - waitForFullQuorum(ctx, f.KubeClient().CoreV1(), sc) - - oldHosts = hosts - oldHostIDs = hostIDs - hosts, hostIDs, err = utils.GetBroadcastRPCAddressesAndUUIDs(ctx, f.KubeClient().CoreV1(), sc) - o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(oldHosts).To(o.HaveLen(5)) - o.Expect(oldHostIDs).To(o.HaveLen(5)) - o.Expect(hosts).To(o.HaveLen(4)) - o.Expect(hostIDs).To(o.HaveLen(4)) - o.Expect(oldHostIDs).To(o.ContainElements(hostIDs)) - - verifyCQLData(ctx, diRF3) - - podName := naming.StatefulSetNameForRack(sc.Spec.Datacenter.Racks[0], sc) + "-1" + podName := naming.StatefulSetNameForRack(sc.Spec.Datacenter.Racks[0], sc) + "-4" svcName := podName - framework.By("Marking ScyllaCluster node #2 (%s) for maintenance", podName) + framework.By("Marking ScyllaCluster node #4 (%s) for maintenance", podName) svc := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ @@ -136,7 +104,7 @@ var _ = g.Describe("ScyllaCluster", func() { ) o.Expect(err).NotTo(o.HaveOccurred()) - framework.By("Manually draining ScyllaCluster node #2 (%s)", podName) + framework.By("Manually draining ScyllaCluster node #4 (%s)", podName) ec := &corev1.EphemeralContainer{ TargetContainerName: naming.ScyllaContainerName, EphemeralContainerCommon: corev1.EphemeralContainerCommon{ @@ -154,6 +122,38 @@ var _ = g.Describe("ScyllaCluster", func() { o.Expect(ephemeralContainerState.State.Terminated).NotTo(o.BeNil()) o.Expect(ephemeralContainerState.State.Terminated.ExitCode).To(o.BeEquivalentTo(0)) + framework.By("Scaling the ScyllaCluster down to 4 replicas") + sc, err = f.ScyllaClient().ScyllaV1().ScyllaClusters(sc.Namespace).Patch( + ctx, + sc.Name, + types.JSONPatchType, + []byte(`[{"op": "replace", "path": "/spec/datacenter/racks/0/members", "value": 4}]`), + metav1.PatchOptions{}, + ) + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(sc.Spec.Datacenter.Racks[0].Members).To(o.BeEquivalentTo(4)) + + framework.By("Waiting for the ScyllaCluster to roll out (RV=%s)", sc.ResourceVersion) + waitCtx3, waitCtx3Cancel := utils.ContextForRollout(ctx, sc) + defer waitCtx3Cancel() + sc, err = controllerhelpers.WaitForScyllaClusterState(waitCtx3, f.ScyllaClient().ScyllaV1().ScyllaClusters(sc.Namespace), sc.Name, controllerhelpers.WaitForStateOptions{}, utils.IsScyllaClusterRolledOut) + o.Expect(err).NotTo(o.HaveOccurred()) + + verifyScyllaCluster(ctx, f.KubeClient(), sc) + waitForFullQuorum(ctx, f.KubeClient().CoreV1(), sc) + + oldHosts = hosts + oldHostIDs = hostIDs + hosts, hostIDs, err = utils.GetBroadcastRPCAddressesAndUUIDs(ctx, f.KubeClient().CoreV1(), sc) + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(oldHosts).To(o.HaveLen(5)) + o.Expect(oldHostIDs).To(o.HaveLen(5)) + o.Expect(hosts).To(o.HaveLen(4)) + o.Expect(hostIDs).To(o.HaveLen(4)) + o.Expect(oldHostIDs).To(o.ContainElements(hostIDs)) + + verifyCQLData(ctx, diRF3) + framework.By("Scaling the ScyllaCluster down to 3 replicas") sc, err = f.ScyllaClient().ScyllaV1().ScyllaClusters(f.Namespace()).Patch( ctx,