@@ -6,6 +6,7 @@ package skip
66import (
77 "testing"
88
9+ carenv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
910 "github.com/stretchr/testify/assert"
1011 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1112 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
@@ -37,14 +38,14 @@ func TestNew(t *testing.T) {
3738 {
3839 name : "ignores empty skip annotation value" ,
3940 annotations : map [string ]string {
40- AnnotationKey : "" ,
41+ carenv1 . PreflightChecksSkipAnnotationKey : "" ,
4142 },
4243 expectCheckNames : map [string ]struct {}{},
4344 },
4445 {
4546 name : "ignores empty check names" ,
4647 annotations : map [string ]string {
47- AnnotationKey : "InfraVMImage,,InfraCredentials," ,
48+ carenv1 . PreflightChecksSkipAnnotationKey : "InfraVMImage,,InfraCredentials," ,
4849 },
4950 expectCheckNames : map [string ]struct {}{
5051 "infravmimage" : {},
@@ -54,14 +55,14 @@ func TestNew(t *testing.T) {
5455 {
5556 name : "ignores value of only commas" ,
5657 annotations : map [string ]string {
57- AnnotationKey : ",,," ,
58+ carenv1 . PreflightChecksSkipAnnotationKey : ",,," ,
5859 },
5960 expectCheckNames : map [string ]struct {}{},
6061 },
6162 {
6263 name : "accepts single check name" ,
6364 annotations : map [string ]string {
64- AnnotationKey : "InfraVMImage" ,
65+ carenv1 . PreflightChecksSkipAnnotationKey : "InfraVMImage" ,
6566 },
6667 expectCheckNames : map [string ]struct {}{
6768 "infravmimage" : {},
@@ -70,7 +71,7 @@ func TestNew(t *testing.T) {
7071 {
7172 name : "accepts multiple check names" ,
7273 annotations : map [string ]string {
73- AnnotationKey : "InfraVMImage,InfraCredentials" ,
74+ carenv1 . PreflightChecksSkipAnnotationKey : "InfraVMImage,InfraCredentials" ,
7475 },
7576 expectCheckNames : map [string ]struct {}{
7677 "infravmimage" : {},
@@ -80,7 +81,7 @@ func TestNew(t *testing.T) {
8081 {
8182 name : "trims spaces from check names" ,
8283 annotations : map [string ]string {
83- AnnotationKey : " InfraVMImage , InfraCredentials " ,
84+ carenv1 . PreflightChecksSkipAnnotationKey : " InfraVMImage , InfraCredentials " ,
8485 },
8586 expectCheckNames : map [string ]struct {}{
8687 "infravmimage" : {},
@@ -125,47 +126,47 @@ func TestEvaluator_For(t *testing.T) {
125126 {
126127 name : "empty annotation value" ,
127128 annotations : map [string ]string {
128- AnnotationKey : "" ,
129+ carenv1 . PreflightChecksSkipAnnotationKey : "" ,
129130 },
130131 checkName : "InfraVMImage" ,
131132 expectMatch : false ,
132133 },
133134 {
134135 name : "skip InfraVMImage check" ,
135136 annotations : map [string ]string {
136- AnnotationKey : "InfraVMImage,InfraCredentials" ,
137+ carenv1 . PreflightChecksSkipAnnotationKey : "InfraVMImage,InfraCredentials" ,
137138 },
138139 checkName : "InfraVMImage" ,
139140 expectMatch : true ,
140141 },
141142 {
142143 name : "skip credentials, but not image" ,
143144 annotations : map [string ]string {
144- AnnotationKey : "InfraCredentials" ,
145+ carenv1 . PreflightChecksSkipAnnotationKey : "InfraCredentials" ,
145146 },
146147 checkName : "InfraVMImage" ,
147148 expectMatch : false ,
148149 },
149150 {
150151 name : "skip with spaces and case mixing" ,
151152 annotations : map [string ]string {
152- AnnotationKey : " infraVMImage , InfraCredentials " ,
153+ carenv1 . PreflightChecksSkipAnnotationKey : " infraVMImage , InfraCredentials " ,
153154 },
154155 checkName : "InfraVMImage" ,
155156 expectMatch : true ,
156157 },
157158 {
158159 name : "extra commas do not affect matching" ,
159160 annotations : map [string ]string {
160- AnnotationKey : "InfraVMImage,,InfraCredentials," ,
161+ carenv1 . PreflightChecksSkipAnnotationKey : "InfraVMImage,,InfraCredentials," ,
161162 },
162163 checkName : "InfraVMImage" ,
163164 expectMatch : true ,
164165 },
165166 {
166167 name : "skip all checks" ,
167168 annotations : map [string ]string {
168- AnnotationKey : "all" ,
169+ carenv1 . PreflightChecksSkipAnnotationKey : "all" ,
169170 },
170171 checkName : "InfraVMImage" ,
171172 expectMatch : true ,
@@ -206,34 +207,34 @@ func TestEvaluator_ForAll(t *testing.T) {
206207 {
207208 name : "empty annotation value" ,
208209 annotations : map [string ]string {
209- AnnotationKey : "" ,
210+ carenv1 . PreflightChecksSkipAnnotationKey : "" ,
210211 },
211212 },
212213 {
213214 name : "skip all checks with spaces and case mixing" ,
214215 annotations : map [string ]string {
215- AnnotationKey : " aLL " ,
216+ carenv1 . PreflightChecksSkipAnnotationKey : " aLL " ,
216217 },
217218 expectMatch : true ,
218219 },
219220 {
220221 name : "skip all checks with extra commas" ,
221222 annotations : map [string ]string {
222- AnnotationKey : ",all,," ,
223+ carenv1 . PreflightChecksSkipAnnotationKey : ",all,," ,
223224 },
224225 expectMatch : true ,
225226 },
226227 {
227228 name : "skip all checks" ,
228229 annotations : map [string ]string {
229- AnnotationKey : "all" ,
230+ carenv1 . PreflightChecksSkipAnnotationKey : "all" ,
230231 },
231232 expectMatch : true ,
232233 },
233234 {
234235 name : "skip some checks, but not all" ,
235236 annotations : map [string ]string {
236- AnnotationKey : "OneCheck,AnotherCheck" ,
237+ carenv1 . PreflightChecksSkipAnnotationKey : "OneCheck,AnotherCheck" ,
237238 },
238239 expectMatch : false ,
239240 },
0 commit comments