Skip to content

Commit

Permalink
Add additional test that the change is actually applied
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Jun 20, 2024
1 parent 4fec4f1 commit 0d25456
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions pkg/reconciliation/construct_statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 0d25456

Please sign in to comment.