@@ -69,3 +69,48 @@ func TestIsPaused(t *testing.T) {
6969 g .Expect (IsPaused (obj )).To (BeTrue ())
7070 })
7171}
72+
73+ func TestSkipValidation (t * testing.T ) {
74+ t .Run ("returns false when annotations are nil" , func (t * testing.T ) {
75+ g := NewWithT (t )
76+ obj := & corev1.ConfigMap {
77+ ObjectMeta : metav1.ObjectMeta {
78+ Name : "test" ,
79+ },
80+ }
81+ g .Expect (SkipValidation (obj )).To (BeFalse ())
82+ })
83+
84+ t .Run ("returns false when annotation is not present" , func (t * testing.T ) {
85+ g := NewWithT (t )
86+ obj := & corev1.ConfigMap {
87+ ObjectMeta : metav1.ObjectMeta {
88+ Name : "test" ,
89+ Annotations : map [string ]string {"other" : "value" },
90+ },
91+ }
92+ g .Expect (SkipValidation (obj )).To (BeFalse ())
93+ })
94+
95+ t .Run ("returns true when annotation is present with empty value" , func (t * testing.T ) {
96+ g := NewWithT (t )
97+ obj := & corev1.ConfigMap {
98+ ObjectMeta : metav1.ObjectMeta {
99+ Name : "test" ,
100+ Annotations : map [string ]string {SkipValidationAnnotation : "" },
101+ },
102+ }
103+ g .Expect (SkipValidation (obj )).To (BeTrue ())
104+ })
105+
106+ t .Run ("returns true when annotation is present with any value" , func (t * testing.T ) {
107+ g := NewWithT (t )
108+ obj := & corev1.ConfigMap {
109+ ObjectMeta : metav1.ObjectMeta {
110+ Name : "test" ,
111+ Annotations : map [string ]string {SkipValidationAnnotation : "true" },
112+ },
113+ }
114+ g .Expect (SkipValidation (obj )).To (BeTrue ())
115+ })
116+ }
0 commit comments