diff --git a/pkg/reconciliation/construct_service_test.go b/pkg/reconciliation/construct_service_test.go index d3bbdaec..d1e2bf5b 100644 --- a/pkg/reconciliation/construct_service_test.go +++ b/pkg/reconciliation/construct_service_test.go @@ -465,15 +465,9 @@ func TestAddingAdditionalAnnotations(t *testing.T) { }, } - expected := map[string]string{ - "Add": "annotation", - } - service := newServiceForCassandraDatacenter(dc) - if !reflect.DeepEqual(expected, service.Annotations) { - t.Errorf("service Annotations = %v, want %v", service.Annotations, expected) - } + assert.Contains(t, service.Annotations, "Add") } func TestServicePorts(t *testing.T) { diff --git a/pkg/reconciliation/construct_statefulset.go b/pkg/reconciliation/construct_statefulset.go index 07c7b53a..e48f3ce6 100644 --- a/pkg/reconciliation/construct_statefulset.go +++ b/pkg/reconciliation/construct_statefulset.go @@ -78,7 +78,7 @@ func newStatefulSetForCassandraDatacenter( statefulSetSelectorLabels := dc.GetRackLabels(rackName) - anns := dc.GetAnnotations() + anns := make(map[string]string) oplabels.AddOperatorAnnotations(anns, dc) var volumeClaimTemplates []corev1.PersistentVolumeClaim diff --git a/pkg/reconciliation/construct_statefulset_test.go b/pkg/reconciliation/construct_statefulset_test.go index 7ffba7d4..0d6d1760 100644 --- a/pkg/reconciliation/construct_statefulset_test.go +++ b/pkg/reconciliation/construct_statefulset_test.go @@ -123,15 +123,13 @@ func Test_newStatefulSetForCassandraDatacenter_additionalLabels(t *testing.T) { assert.Equal(t, expectedStatefulsetLabels, volumeClaim.Labels) } - assert.Equal(t, - map[string]string{ - "Add": "annotation"}, - statefulset.Annotations) + assert.Contains(t, + statefulset.Annotations, "Add") for _, volumeClaim := range statefulset.Spec.VolumeClaimTemplates { - assert.Equal(t, map[string]string{ - "Add": "annotation"}, - volumeClaim.Annotations) + assert.Contains(t, + volumeClaim.Annotations, + "Add") } }