@@ -2071,7 +2071,8 @@ func TestReconcileMachinePhases(t *testing.T) {
2071
2071
2072
2072
g .Expect (env .Create (ctx , bootstrapConfig )).To (Succeed ())
2073
2073
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2074
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2074
+ // Create and wait on machine to make sure caches sync and reconciliation triggers.
2075
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2075
2076
2076
2077
// Wait until BootstrapConfig has the ownerReference.
2077
2078
g .Eventually (func (g Gomega ) bool {
@@ -2123,7 +2124,8 @@ func TestReconcileMachinePhases(t *testing.T) {
2123
2124
2124
2125
g .Expect (env .Create (ctx , bootstrapConfig )).To (Succeed ())
2125
2126
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2126
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2127
+ // Create and wait on machine to make sure caches sync and reconciliation triggers.
2128
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2127
2129
2128
2130
// Wait until Machine was reconciled.
2129
2131
g .Eventually (func (g Gomega ) bool {
@@ -2168,7 +2170,7 @@ func TestReconcileMachinePhases(t *testing.T) {
2168
2170
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2169
2171
// We have to subtract 2 seconds, because .status.lastUpdated does not contain milliseconds.
2170
2172
preUpdate := time .Now ().Add (- 2 * time .Second )
2171
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2173
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2172
2174
2173
2175
// Set the LastUpdated to be able to verify it is updated when the phase changes
2174
2176
modifiedMachine := machine .DeepCopy ()
@@ -2240,7 +2242,9 @@ func TestReconcileMachinePhases(t *testing.T) {
2240
2242
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2241
2243
// We have to subtract 2 seconds, because .status.lastUpdated does not contain milliseconds.
2242
2244
preUpdate := time .Now ().Add (- 2 * time .Second )
2243
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2245
+
2246
+ // Create and wait on machine to make sure caches sync and reconciliation triggers.
2247
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2244
2248
2245
2249
modifiedMachine := machine .DeepCopy ()
2246
2250
// Set NodeRef.
@@ -2329,7 +2333,8 @@ func TestReconcileMachinePhases(t *testing.T) {
2329
2333
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2330
2334
// We have to subtract 2 seconds, because .status.lastUpdated does not contain milliseconds.
2331
2335
preUpdate := time .Now ().Add (- 2 * time .Second )
2332
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2336
+ // Create and wait on machine to make sure caches sync and reconciliation triggers.
2337
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2333
2338
2334
2339
modifiedMachine := machine .DeepCopy ()
2335
2340
// Set NodeRef.
@@ -2407,7 +2412,8 @@ func TestReconcileMachinePhases(t *testing.T) {
2407
2412
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2408
2413
// We have to subtract 2 seconds, because .status.lastUpdated does not contain milliseconds.
2409
2414
preUpdate := time .Now ().Add (- 2 * time .Second )
2410
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2415
+ // Create and wait on machine to make sure caches sync and reconciliation triggers.
2416
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2411
2417
2412
2418
modifiedMachine := machine .DeepCopy ()
2413
2419
// Set NodeRef.
@@ -2474,7 +2480,8 @@ func TestReconcileMachinePhases(t *testing.T) {
2474
2480
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2475
2481
// We have to subtract 2 seconds, because .status.lastUpdated does not contain milliseconds.
2476
2482
preUpdate := time .Now ().Add (- 2 * time .Second )
2477
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2483
+ // Create and wait on machine to make sure caches sync and reconciliation triggers.
2484
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2478
2485
2479
2486
// Set bootstrap ready.
2480
2487
modifiedBootstrapConfig := bootstrapConfig .DeepCopy ()
@@ -2546,7 +2553,8 @@ func TestReconcileMachinePhases(t *testing.T) {
2546
2553
g .Expect (env .Create (ctx , infraMachine )).To (Succeed ())
2547
2554
// We have to subtract 2 seconds, because .status.lastUpdated does not contain milliseconds.
2548
2555
preUpdate := time .Now ().Add (- 2 * time .Second )
2549
- g .Expect (env .Create (ctx , machine )).To (Succeed ())
2556
+ // Create and wait on machine to make sure caches sync and reconciliation triggers.
2557
+ g .Expect (env .CreateAndWait (ctx , machine )).To (Succeed ())
2550
2558
2551
2559
// Set bootstrap ready.
2552
2560
modifiedBootstrapConfig := bootstrapConfig .DeepCopy ()
@@ -2578,7 +2586,7 @@ func TestReconcileMachinePhases(t *testing.T) {
2578
2586
g .Expect (env .Patch (ctx , modifiedMachine , client .MergeFrom (machine ))).To (Succeed ())
2579
2587
2580
2588
// Delete Machine
2581
- g .Expect (env .Delete (ctx , machine )).To (Succeed ())
2589
+ g .Expect (env .DeleteAndWait (ctx , machine )).To (Succeed ())
2582
2590
2583
2591
// Wait until Machine was reconciled.
2584
2592
g .Eventually (func (g Gomega ) bool {
0 commit comments