@@ -15,7 +15,7 @@ import (
1515 e2e "k8s.io/kubernetes/test/e2e/framework"
1616)
1717
18- const mapiBaseErrorMessageTemplate = `1 Degraded MAPI MachineSets | 0 Degraded ControlPlaneMachineSets | 0 Degraded CAPI MachineSets | 0 CAPI MachineDeployments | Error(s):` +
18+ const mapiBaseErrorMessageTemplate = `1 Degraded MAPI MachineSets | 0 Degraded ControlPlaneMachineSets | 0 Degraded CAPI MachineSets | 0 Degraded CAPI MachineDeployments | Error(s):` +
1919 ` error syncing MAPI MachineSet %s: failed to reconcile machineset %s, err:`
2020
2121var _ = g .Describe ("[sig-mco][Suite:openshift/machine-config-operator/longduration][Serial][Disruptive] MCO Bootimages" , func () {
@@ -44,6 +44,20 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
4444 wMcp = NewMachineConfigPool (oc .AsAdmin (), MachineConfigPoolWorker )
4545 machineConfiguration = GetMachineConfiguration (oc .AsAdmin ())
4646 PreChecks (oc )
47+
48+ // Disable skew to avoid collisions
49+ exutil .By ("Disabling skew functionality" )
50+ initialMachineConfiguration := machineConfiguration .GetSpecOrFail ()
51+ o .Expect (machineConfiguration .SetNoneSkew ()).To (o .Succeed (), "Error disabing the skew functionality" )
52+ o .Eventually (machineConfiguration .IsGenerationUpToDate , "2m" , "10s" ).Should (o .BeTrue (), "MachineConfiguration observedGeneration did not catch up to generation" )
53+
54+ g .DeferCleanup (func () {
55+ exutil .By ("Restoring initial MachineConfiguration spec" )
56+ o .Expect (machineConfiguration .SetSpec (initialMachineConfiguration )).To (o .Succeed (), "Error restoring initial MachineConfiguration spec" )
57+ logger .Infof ("OK!\n " )
58+ })
59+ logger .Infof ("OK!\n " )
60+
4761 })
4862
4963 g .It ("[PolarionID:81403][OTP] In BootImages Machineset should update by default" , g .Label ("Platform:aws" , "Platform:gcp" ), func () {
@@ -75,7 +89,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
7589
7690 // For none - mode i.e opt-out MachineSet are not updated with original value if we try to set with any fake value
7791 exutil .By ("Opt-out boot images update" )
78- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
7992 o .Expect (
8093 machineConfiguration .SetNoneManagedBootImagesConfig (MachineSetResource ),
8194 ).To (o .Succeed (), "Error configuring None managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -127,7 +140,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
127140 logger .Infof ("OK!\n " )
128141
129142 exutil .By ("Opt-in boot images update" )
130- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
131143 o .Expect (
132144 machineConfiguration .SetAllManagedBootImagesConfig (MachineSetResource ),
133145 ).To (o .Succeed (), "Error configuring ALL managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -229,7 +241,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
229241
230242 exutil .By ("Opt-in boot images update" )
231243
232- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
233244 o .Expect (
234245 machineConfiguration .SetPartialManagedBootImagesConfig (MachineSetResource , labelName , labelValue ),
235246 ).To (o .Succeed (), "Error configuring Partial managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -329,7 +340,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
329340 )
330341 exutil .By ("Opt-in boot images update" )
331342
332- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
333343 o .Expect (
334344 machineConfiguration .SetPartialManagedBootImagesConfig (MachineSetResource , labelName , labelValue ),
335345 ).To (o .Succeed (), "Error configuring Partial managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -475,7 +485,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
475485 logger .Infof ("OK!\n " )
476486
477487 exutil .By ("To patch the Partial Mode in machineConfiguration" )
478- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
479488 o .Expect (
480489 machineConfiguration .SetPartialManagedBootImagesConfig (MachineSetResource , "" , "" ),
481490 ).To (o .Succeed (), "Error configuring Partial managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -484,7 +493,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
484493 logger .Infof ("OK\n " )
485494
486495 exutil .By ("To patch the All Mode in machieConfiguration" )
487- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
488496 o .Expect (
489497 machineConfiguration .SetAllManagedBootImagesConfig (MachineSetResource ),
490498 ).To (o .Succeed (), "Error configuring All managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -493,7 +501,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
493501 logger .Infof ("OK\n " )
494502
495503 exutil .By ("Opt-out boot images update" )
496- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
497504 o .Expect (machineConfiguration .SetNoneManagedBootImagesConfig (MachineSetResource )).To (o .Succeed (), "Error configuring None managedBootImages in the 'cluster' MachineConfiguration resource" )
498505 logger .Infof ("OK!\n " )
499506 checkManagedBootImagesStatus (machineConfiguration , "None" )
@@ -517,7 +524,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
517524
518525 exutil .By ("Opt-in boot images update" )
519526
520- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
521527 o .Expect (
522528 machineConfiguration .SetPartialManagedBootImagesConfig (MachineSetResource , labelName , labelValue ),
523529 ).To (o .Succeed (), "Error configuring Partial managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -606,7 +612,6 @@ var _ = g.Describe("[sig-mco][Suite:openshift/machine-config-operator/longdurati
606612 )
607613
608614 exutil .By ("Opt-in boot images update" )
609- defer machineConfiguration .SetSpec (machineConfiguration .GetSpecOrFail ())
610615 o .Expect (
611616 machineConfiguration .SetPartialManagedBootImagesConfig (MachineSetResource , labelName , labelValue ),
612617 ).To (o .Succeed (), "Error configuring Partial managedBootImages in the 'cluster' MachineConfiguration resource" )
@@ -806,19 +811,17 @@ func GetRHCOSVersionFromConfigMap(oc *exutil.CLI) string {
806811func testUserDataUpdateFailure (oc * exutil.CLI , clonedMSName , clonedSecretName , expectedFailedMessageRegexp string , userDataModifyFunc func (userData string ) (string , error )) {
807812
808813 var (
809- machineConfiguration = GetMachineConfiguration (oc .AsAdmin ())
810- machineSet = NewMachineSetList (oc .AsAdmin (), MachineAPINamespace ).GetAllOrFail ()[0 ]
811- fakeImageName = getBackdatedBootImage (oc .AsAdmin ())
812- labelName = "test"
813- labelValue = "update"
814- secondLabelValue = "update2"
815- machineClusterOperator = NewResource (oc .AsAdmin (), "ClusterOperator" , "machine-config" )
816- initialMachineConfigSpec = machineConfiguration .GetSpecOrFail ()
817- clonedSecret * Secret
814+ machineConfiguration = GetMachineConfiguration (oc .AsAdmin ())
815+ machineSet = NewMachineSetList (oc .AsAdmin (), MachineAPINamespace ).GetAllOrFail ()[0 ]
816+ fakeImageName = getBackdatedBootImage (oc .AsAdmin ())
817+ labelName = "test"
818+ labelValue = "update"
819+ secondLabelValue = "update2"
820+ machineClusterOperator = NewResource (oc .AsAdmin (), "ClusterOperator" , "machine-config" )
821+ clonedSecret * Secret
818822 )
819823
820824 exutil .By ("Opt-in boot images update" )
821- defer machineConfiguration .SetSpec (initialMachineConfigSpec )
822825 o .Expect (
823826 machineConfiguration .SetPartialManagedBootImagesConfig (MachineSetResource , labelName , labelValue ),
824827 ).To (o .Succeed (), "Error configuring Partial managedBootImages in the 'cluster' MachineConfiguration resource" )
0 commit comments