diff --git a/controllers/k8ssandra/medusa_reconciler_test.go b/controllers/k8ssandra/medusa_reconciler_test.go index fe5d94c64..a534d6281 100644 --- a/controllers/k8ssandra/medusa_reconciler_test.go +++ b/controllers/k8ssandra/medusa_reconciler_test.go @@ -246,20 +246,9 @@ func createMultiDcClusterWithMedusa(t *testing.T, ctx context.Context, f *framew require.True(err != nil && errors.IsNotFound(err), "dc2 should not be created until dc1 is ready") t.Log("update dc1 status to ready") - err = f.PatchDatacenterStatus(ctx, dc1Key, func(dc *cassdcapi.CassandraDatacenter) { - dc.Status.CassandraOperatorProgress = cassdcapi.ProgressReady - dc.SetCondition(cassdcapi.DatacenterCondition{ - Type: cassdcapi.DatacenterReady, - Status: corev1.ConditionTrue, - LastTransitionTime: metav1.Now(), - }) - }) + err = f.SetDatacenterStatusReady(ctx, dc1Key) require.NoError(err, "failed to update dc1 status to ready") - require.Eventually(func() bool { - return f.UpdateDatacenterGeneration(ctx, t, dc1Key) - }, timeout, interval, "failed to update dc1 generation") - reconcileMedusaStandaloneDeployment(ctx, t, f, kc, "dc2", f.DataPlaneContexts[1]) t.Log("check that dc2 was created") require.Eventually(f.DatacenterExists(ctx, dc2Key), timeout, interval) @@ -290,20 +279,11 @@ func createMultiDcClusterWithMedusa(t *testing.T, ctx context.Context, f *framew require.NoError(err, "failed to get dc2") t.Log("update dc2 status to ready") - err = f.PatchDatacenterStatus(ctx, dc2Key, func(dc *cassdcapi.CassandraDatacenter) { - dc.Status.CassandraOperatorProgress = cassdcapi.ProgressReady - dc.SetCondition(cassdcapi.DatacenterCondition{ - Type: cassdcapi.DatacenterReady, - Status: corev1.ConditionTrue, - LastTransitionTime: metav1.Now(), - }) - }) + if err = f.SetDatacenterStatusReady(ctx, dc2Key); err != nil { + assert.Fail(t, "error setting status ready", err) + } require.NoError(err, "failed to update dc2 status to ready") - require.Eventually(func() bool { - return f.UpdateDatacenterGeneration(ctx, t, dc2Key) - }, timeout, interval, "failed to update dc2 generation") - t.Log("check that dc2 was rebuilt") verifyRebuildTaskCreated(ctx, t, f, dc2Key, dc1Key) rebuildTaskKey := framework.NewClusterKey(f.DataPlaneContexts[1], kc.Namespace, "dc2-rebuild") diff --git a/test/framework/framework.go b/test/framework/framework.go index 275788484..1f56cc6a1 100644 --- a/test/framework/framework.go +++ b/test/framework/framework.go @@ -298,6 +298,13 @@ func (f *Framework) SetDatacenterStatusReady(ctx context.Context, key ClusterKey LastTransitionTime: now, }) dc.Status.ObservedGeneration = dc.Generation + dc.Status.NodeStatuses = cassdcapi.CassandraStatusMap{} + for i := 0; i < int(dc.Spec.Size); i++ { + dc.Status.NodeStatuses[fmt.Sprintf("node%d", i)] = cassdcapi.CassandraNodeStatus{ + HostID: fmt.Sprintf("host%d", i), + } + + } }) }