Skip to content

Commit

Permalink
increase test cov
Browse files Browse the repository at this point in the history
Signed-off-by: zachaller <[email protected]>
  • Loading branch information
zachaller committed Jul 21, 2023
1 parent 2842baa commit 64e2ad9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions utils/annotations/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,43 @@ func TestReplicasAnnotationsNeedUpdate(t *testing.T) {
})
}
}

func TestGetRevisionAnnotation(t *testing.T) {
rev, found := GetRevisionAnnotation(&v1alpha1.Rollout{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: metav1.NamespaceDefault,
Annotations: map[string]string{
RevisionAnnotation: "1",
},
},
})
assert.True(t, found)
assert.Equal(t, int32(1), rev)

rev, found = GetRevisionAnnotation(&v1alpha1.Rollout{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: metav1.NamespaceDefault,
Annotations: map[string]string{},
},
})
assert.False(t, found)
assert.Equal(t, int32(0), rev)

rev, found = GetRevisionAnnotation(nil)
assert.False(t, found)
assert.Equal(t, int32(0), rev)

rev, found = GetRevisionAnnotation(&v1alpha1.Rollout{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: metav1.NamespaceDefault,
Annotations: map[string]string{
RevisionAnnotation: "abc",
},
},
})
assert.False(t, found)
assert.Equal(t, int32(0), rev)
}

0 comments on commit 64e2ad9

Please sign in to comment.