@@ -73,7 +73,12 @@ func Test_GetRemovedAPIsOn1_25From(t *testing.T) {
7373
7474 warnMock := make (map [string ][]string )
7575 warnMock ["cronjobs" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.ClusterPermissions[0].Rules[7]" }
76+ warnMock ["endpointslices" ] = []string {"ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[0].Rules[3]" }
7677 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]" }
7782
7883 type args struct {
7984 bundleDir string
@@ -98,6 +103,14 @@ func Test_GetRemovedAPIsOn1_25From(t *testing.T) {
98103 bundleDir : "./testdata/removed_api_1_25" ,
99104 },
100105 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 ,
101114 warnWant : warnMock ,
102115 },
103116 }
@@ -187,11 +200,7 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
187200 warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.22. " +
188201 "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
189202 "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\" ])" },
195204 },
196205 {
197206 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) {
205214 "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
206215 "Migrate the API(s) for CRD: ([\" etcdbackups.etcd.database.coreos.com\" " +
207216 " \" 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]\" ])" },
213217 },
214218 {
215219 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) {
223227 "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
224228 "Migrate the API(s) for HorizontalPodAutoscaler: ([\" memcached-operator-hpa\" ])," +
225229 "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]\" ])," },
232230 },
233231 {
234232 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) {
241239 warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.25. " +
242240 "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25. " +
243241 "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\" ])," },
250243 },
251244 {
252245 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) {
259252 errStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.26. " +
260253 "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-26. " +
261254 "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]\" ])" },
267255 },
268256 {
269257 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) {
273261 directory : "./testdata/removed_api_1_26" ,
274262 },
275263 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\" ])" },
283267 },
284268 {
285269 name : "should return an error when the k8sVersion informed is invalid" ,
@@ -294,11 +278,7 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
294278 warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.22. " +
295279 "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
296280 "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\" ])" },
302282 },
303283 {
304284 name : "should return an error when the csv.spec.minKubeVersion informed is invalid" ,
@@ -313,11 +293,7 @@ func TestValidateDeprecatedAPIS(t *testing.T) {
313293 warnStrings : []string {"this bundle is using APIs which were deprecated and removed in v1.22. " +
314294 "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22. " +
315295 "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\" ])" },
321297 },
322298 }
323299 for _ , tt := range tests {
0 commit comments