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