@@ -143,8 +143,17 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
143143 irqLoadBalancingDisabled = ! irqLoadBalancingDisabled
144144 profile .Spec .GloballyDisableIrqLoadBalancing = & irqLoadBalancingDisabled
145145
146- By ("Updating the performance profile" )
147- profiles .UpdateWithRetry (profile )
146+ spec , err := json .Marshal (profile .Spec )
147+ Expect (err ).ToNot (HaveOccurred ())
148+
149+ By ("Applying changes in performance profile and waiting until mcp will start updating" )
150+ Expect (testclient .Client .Patch (context .TODO (), profile ,
151+ client .RawPatch (
152+ types .JSONPatchType ,
153+ []byte (fmt .Sprintf (`[{ "op": "replace", "path": "/spec", "value": %s }]` , spec )),
154+ ),
155+ )).ToNot (HaveOccurred ())
156+
148157 defer func () { // return initial configuration
149158 spec , err := json .Marshal (initialProfile .Spec )
150159 Expect (err ).ToNot (HaveOccurred ())
@@ -207,8 +216,16 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
207216 By ("Verifying that mcp is ready for update" )
208217 mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolUpdated , corev1 .ConditionTrue )
209218
219+ spec , err := json .Marshal (profile .Spec )
220+ Expect (err ).ToNot (HaveOccurred ())
221+
210222 By ("Applying changes in performance profile and waiting until mcp will start updating" )
211- profiles .UpdateWithRetry (profile )
223+ Expect (testclient .Client .Patch (context .TODO (), profile ,
224+ client .RawPatch (
225+ types .JSONPatchType ,
226+ []byte (fmt .Sprintf (`[{ "op": "replace", "path": "/spec", "value": %s }]` , spec )),
227+ ),
228+ )).ToNot (HaveOccurred ())
212229 mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolUpdating , corev1 .ConditionTrue )
213230
214231 By ("Waiting when mcp finishes updates" )
@@ -286,8 +303,16 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
286303 By ("Verifying that mcp is ready for update" )
287304 mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolUpdated , corev1 .ConditionTrue )
288305
306+ spec , err := json .Marshal (profile .Spec )
307+ Expect (err ).ToNot (HaveOccurred ())
308+
289309 By ("Applying changes in performance profile and waiting until mcp will start updating" )
290- profiles .UpdateWithRetry (profile )
310+ Expect (testclient .Client .Patch (context .TODO (), profile ,
311+ client .RawPatch (
312+ types .JSONPatchType ,
313+ []byte (fmt .Sprintf (`[{ "op": "replace", "path": "/spec", "value": %s }]` , spec )),
314+ ),
315+ )).ToNot (HaveOccurred ())
291316 mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolUpdating , corev1 .ConditionTrue )
292317
293318 By ("Waiting when mcp finishes updates" )
@@ -355,7 +380,16 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
355380
356381 By ("Applying changes in performance profile" )
357382 profile .Spec .RealTimeKernel = nil
358- profiles .UpdateWithRetry (profile )
383+ spec , err := json .Marshal (profile .Spec )
384+ Expect (err ).ToNot (HaveOccurred ())
385+
386+ By ("Applying changes in performance profile and waiting until mcp will start updating" )
387+ Expect (testclient .Client .Patch (context .TODO (), profile ,
388+ client .RawPatch (
389+ types .JSONPatchType ,
390+ []byte (fmt .Sprintf (`[{ "op": "replace", "path": "/spec", "value": %s }]` , spec )),
391+ ),
392+ )).ToNot (HaveOccurred ())
359393
360394 Expect (profile .Spec .RealTimeKernel ).To (BeNil (), "real time kernel setting expected in profile spec but missing" )
361395 By ("Checking that the updating MCP status will consistently stay false" )
@@ -384,6 +418,8 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
384418 })
385419 })
386420
421+ // TODO: we have a dependency between tests(that in general bad practice, but saves us some tests run time),
422+ // once we will want to run tests in the random order or without failFast we will need to refactor tests
387423 Context ("Updating of nodeSelector parameter and node labels" , func () {
388424 var mcp * machineconfigv1.MachineConfigPool
389425 var newCnfNode * corev1.Node
@@ -418,7 +454,16 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
418454
419455 By ("Updating Node Selector performance profile" )
420456 profile .Spec .NodeSelector = newNodeSelector
421- profiles .UpdateWithRetry (profile )
457+ spec , err := json .Marshal (profile .Spec )
458+ Expect (err ).ToNot (HaveOccurred ())
459+
460+ By ("Applying changes in performance profile and waiting until mcp will start updating" )
461+ Expect (testclient .Client .Patch (context .TODO (), profile ,
462+ client .RawPatch (
463+ types .JSONPatchType ,
464+ []byte (fmt .Sprintf (`[{ "op": "replace", "path": "/spec", "value": %s }]` , spec )),
465+ ),
466+ )).ToNot (HaveOccurred ())
422467 mcps .WaitForCondition (newRole , machineconfigv1 .MachineConfigPoolUpdating , corev1 .ConditionTrue )
423468
424469 By ("Waiting when MCP finishes updates and verifying new node has updated configuration" )
@@ -480,7 +525,7 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
480525 })
481526
482527 It ("Reverts back nodeSelector and cleaning up leftovers" , func () {
483- selectorLabels := []string {}
528+ var selectorLabels []string
484529 for k , v := range testutils .NodeSelectorLabels {
485530 selectorLabels = append (selectorLabels , fmt .Sprintf (`"%s":"%s"` , k , v ))
486531 }
@@ -499,7 +544,7 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
499544 Namespace : profile .Namespace ,
500545 }
501546 Expect (testclient .Client .Get (context .TODO (), key , updatedProfile )).ToNot (HaveOccurred ())
502- updatedSelectorLabels := []string {}
547+ var updatedSelectorLabels []string
503548 for k , v := range updatedProfile .Spec .NodeSelector {
504549 updatedSelectorLabels = append (updatedSelectorLabels , fmt .Sprintf (`"%s":"%s"` , k , v ))
505550 }
@@ -511,6 +556,9 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance
511556 Expect (err ).ToNot (HaveOccurred ())
512557 Expect (testclient .Client .Delete (context .TODO (), mcp )).ToNot (HaveOccurred ())
513558 mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolUpdated , corev1 .ConditionTrue )
559+
560+ // revert node label to have the expected value
561+ nodeLabel = testutils .NodeSelectorLabels
514562 })
515563 })
516564})
0 commit comments