diff --git a/pkg/reconciliation/construct_statefulset_test.go b/pkg/reconciliation/construct_statefulset_test.go index bfb96939..45e02997 100644 --- a/pkg/reconciliation/construct_statefulset_test.go +++ b/pkg/reconciliation/construct_statefulset_test.go @@ -712,3 +712,35 @@ func TestPodTemplateSpecHashAnnotationChanges(t *testing.T) { updatedHash = sts.Annotations[utils.ResourceHashAnnotationKey] assert.NotEqual(currentHash, updatedHash, "expected hash to change when PodTemplateSpec labels change") } + +func TestMinReadySecondsChange(t *testing.T) { + assert := assert.New(t) + dc := &api.CassandraDatacenter{ + Spec: api.CassandraDatacenterSpec{ + ClusterName: "test", + ServerType: "cassandra", + ServerVersion: "4.0.7", + StorageConfig: api.StorageConfig{ + CassandraDataVolumeClaimSpec: &corev1.PersistentVolumeClaimSpec{}, + }, + Racks: []api.Rack{ + { + Name: "testrack", + }, + }, + PodTemplateSpec: &corev1.PodTemplateSpec{}, + }, + } + + sts, err := newStatefulSetForCassandraDatacenter(nil, dc.Spec.Racks[0].Name, dc, 3) + assert.NoError(err, "failed to build statefulset") + + assert.Equal(int32(5), sts.Spec.MinReadySeconds) + + dc.Spec.MinReadySeconds = ptr.To[int32](10) + + sts, err = newStatefulSetForCassandraDatacenter(nil, dc.Spec.Racks[0].Name, dc, 3) + assert.NoError(err, "failed to build statefulset") + + assert.Equal(int32(10), sts.Spec.MinReadySeconds) +}