@@ -238,6 +238,48 @@ var _ = Describe("upgradePatches", func() {
238
238
Expect (newHc .Spec .FeatureGates .WithHostPassthroughCPU ).To (BeNil ())
239
239
Expect (newHc .Spec .FeatureGates .PrimaryUserDefinedNetworkBinding ).To (BeNil ())
240
240
})
241
+
242
+ DescribeTable ("Moving the deprecated EnableCommonBootImageImport FG to a new field" ,
243
+ func (oldFG , newFG * bool , ver semver.Version , assertField , assertFG types.GomegaMatcher ) {
244
+ hc := components .GetOperatorCR ()
245
+ hc .Spec .FeatureGates .EnableCommonBootImageImport = oldFG
246
+ hc .Spec .EnableCommonBootImageImport = newFG
247
+
248
+ newHc , err := ApplyUpgradePatch (GinkgoLogr , hc , ver )
249
+ Expect (err ).NotTo (HaveOccurred ())
250
+
251
+ Expect (newHc .Spec .EnableCommonBootImageImport ).To (assertField )
252
+ Expect (newHc .Spec .FeatureGates .EnableCommonBootImageImport ).To (assertFG )
253
+ },
254
+ Entry ("should move if the old value is not the default value" ,
255
+ ptr .To (false ),
256
+ ptr .To (true ),
257
+ semver .MustParse ("1.14.0" ),
258
+ HaveValue (BeFalse ()),
259
+ BeNil (),
260
+ ),
261
+ Entry ("should not move for newer versions" ,
262
+ ptr .To (false ),
263
+ ptr .To (true ),
264
+ semver .MustParse ("1.15.0" ),
265
+ HaveValue (BeTrue ()),
266
+ HaveValue (BeFalse ()),
267
+ ),
268
+ Entry ("should not move if the old FG is empty" ,
269
+ nil ,
270
+ ptr .To (true ),
271
+ semver .MustParse ("1.14.0" ),
272
+ HaveValue (BeTrue ()),
273
+ BeNil (),
274
+ ),
275
+ Entry ("should not move if the old FG is the default one" ,
276
+ ptr .To (true ),
277
+ ptr .To (false ),
278
+ semver .MustParse ("1.14.0" ),
279
+ HaveValue (BeFalse ()),
280
+ BeNil (),
281
+ ),
282
+ )
241
283
})
242
284
})
243
285
0 commit comments