@@ -74,7 +74,12 @@ func Test_GetRemovedAPIsOn1_25From(t *testing.T) {
74
74
75
75
warnMock := make (map [string ][]string )
76
76
warnMock ["cronjobs" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.ClusterPermissions[0].Rules[7]" }
77
+ warnMock ["endpointslices" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[3]" }
77
78
warnMock ["events" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[2]" }
79
+ warnMock ["horizontalpodautoscalers" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[4]" }
80
+ warnMock ["poddisruptionbudgets" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[5]" }
81
+ warnMock ["podsecuritypolicies" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[5]" }
82
+ warnMock ["runtimeclasses" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[6]" }
78
83
79
84
type args struct {
80
85
bundleDir string
@@ -99,6 +104,14 @@ func Test_GetRemovedAPIsOn1_25From(t *testing.T) {
99
104
bundleDir : "./testdata/removed_api_1_25" ,
100
105
},
101
106
errWant : mock ,
107
+ warnWant : map [string ][]string {},
108
+ },
109
+ {
110
+ name : "should return warnings with all deprecated APIs in 1.25" ,
111
+ args : args {
112
+ bundleDir : "./testdata/deprecated_api_1_25" ,
113
+ },
114
+ errWant : mock ,
102
115
warnWant : warnMock ,
103
116
},
104
117
}
@@ -188,11 +201,7 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
188
201
warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.22. " +
189
202
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
190
203
"Migrate the API(s) for CRD: ([\" etcdbackups.etcd.database.coreos.com\" " +
191
- "\" etcdclusters.etcd.database.coreos.com\" \" etcdrestores.etcd.database.coreos.com\" ])" ,
192
- "this bundle is using APIs which were deprecated and removed in v1.25. " +
193
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
194
- "Migrate the API(s) for events: " +
195
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[1]\" ])" },
204
+ "\" etcdclusters.etcd.database.coreos.com\" \" etcdrestores.etcd.database.coreos.com\" ])" },
196
205
},
197
206
{
198
207
name : "should return an error when the k8sVersion is >= 1.22 and has the deprecated API" ,
@@ -206,11 +215,6 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
206
215
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
207
216
"Migrate the API(s) for CRD: ([\" etcdbackups.etcd.database.coreos.com\" " +
208
217
" \" etcdclusters.etcd.database.coreos.com\" \" etcdrestores.etcd.database.coreos.com\" ])" },
209
- wantWarning : true ,
210
- warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.25. " +
211
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
212
- "Migrate the API(s) for events: " +
213
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[1]\" ])" },
214
218
},
215
219
{
216
220
name : "should return an error when the k8sVersion is >= 1.25 and found removed APIs on 1.25" ,
@@ -224,12 +228,6 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
224
228
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
225
229
"Migrate the API(s) for HorizontalPodAutoscaler: ([\" memcached-operator-hpa\" ])," +
226
230
"PodDisruptionBudget: ([\" memcached-operator-policy-manager\" ])," },
227
- wantWarning : true ,
228
- warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.25. " +
229
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
230
- "Migrate the API(s) for cronjobs: " +
231
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.ClusterPermissions[0].Rules[7]\" ])" +
232
- ",events: ([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[2]\" ])," },
233
231
},
234
232
{
235
233
name : "should return a warning if the k8sVersion is empty and found removed APIs on 1.25" ,
@@ -242,12 +240,7 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
242
240
warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.25. " +
243
241
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
244
242
"Migrate the API(s) for HorizontalPodAutoscaler: ([\" memcached-operator-hpa\" ])," +
245
- "PodDisruptionBudget: ([\" memcached-operator-policy-manager\" ])," ,
246
- "this bundle is using APIs which were deprecated and removed in v1.25. " +
247
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
248
- "Migrate the API(s) for cronjobs: " +
249
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.ClusterPermissions[0].Rules[7]\" ])" +
250
- ",events: ([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[2]\" ])," },
243
+ "PodDisruptionBudget: ([\" memcached-operator-policy-manager\" ])," },
251
244
},
252
245
{
253
246
name : "should return an error when the k8sVersion is >= 1.26 and found removed APIs on 1.26" ,
@@ -260,11 +253,6 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
260
253
errStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.26. " +
261
254
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-26. " +
262
255
"Migrate the API(s) for HorizontalPodAutoscaler: ([\" memcached-operator-hpa\" ])" },
263
- wantWarning : true ,
264
- warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.25. " +
265
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
266
- "Migrate the API(s) for events: " +
267
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[2]\" ])" },
268
256
},
269
257
{
270
258
name : "should return a warning when the k8sVersion is empty and found removed APIs on 1.26" ,
@@ -274,13 +262,9 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
274
262
directory : "./testdata/removed_api_1_26" ,
275
263
},
276
264
wantWarning : true ,
277
- warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.25. " +
278
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
279
- "Migrate the API(s) for events: " +
280
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[2]\" ])" ,
281
- "this bundle is using APIs which were deprecated and removed in v1.26. " +
282
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-26. " +
283
- "Migrate the API(s) for HorizontalPodAutoscaler: ([\" memcached-operator-hpa\" ])" },
265
+ warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.26. " +
266
+ "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-26. " +
267
+ "Migrate the API(s) for HorizontalPodAutoscaler: ([\" memcached-operator-hpa\" ])" },
284
268
},
285
269
{
286
270
name : "should return an error when the k8sVersion informed is invalid" ,
@@ -295,11 +279,7 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
295
279
warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.22. " +
296
280
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
297
281
"Migrate the API(s) for CRD: ([\" etcdbackups.etcd.database.coreos.com\" " +
298
- "\" etcdclusters.etcd.database.coreos.com\" \" etcdrestores.etcd.database.coreos.com\" ])" ,
299
- "this bundle is using APIs which were deprecated and removed in v1.25. " +
300
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
301
- "Migrate the API(s) for events: " +
302
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[1]\" ])" },
282
+ "\" etcdclusters.etcd.database.coreos.com\" \" etcdrestores.etcd.database.coreos.com\" ])" },
303
283
},
304
284
{
305
285
name : "should return an error when the csv.spec.minKubeVersion informed is invalid" ,
@@ -314,11 +294,7 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
314
294
warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.22. " +
315
295
"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
316
296
"Migrate the API(s) for CRD: ([\" etcdbackups.etcd.database.coreos.com\" " +
317
- "\" etcdclusters.etcd.database.coreos.com\" \" etcdrestores.etcd.database.coreos.com\" ])" ,
318
- "this bundle is using APIs which were deprecated and removed in v1.25. " +
319
- "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
320
- "Migrate the API(s) for events: " +
321
- "([\" ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[1]\" ])" },
297
+ "\" etcdclusters.etcd.database.coreos.com\" \" etcdrestores.etcd.database.coreos.com\" ])" },
322
298
},
323
299
}
324
300
for _ , tt := range tests {
0 commit comments