Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey committed Dec 19, 2023
1 parent 1c7fbbb commit e17c5c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
8 changes: 1 addition & 7 deletions pkg/reconciliation/construct_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciliation/construct_statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions pkg/reconciliation/construct_statefulset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

}
Expand Down

0 comments on commit e17c5c0

Please sign in to comment.