Skip to content

Commit c455919

Browse files
committed
fix TestReconcileMachinePoolScaleToFromZero flakes
Replace env.Create and env.Cleanup with env.CreateAndWait and env.CleanupAndWait, remove namespace from cleanup.
1 parent ef2f673 commit c455919

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

exp/internal/controllers/machinepool_controller_phases_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,11 +1513,11 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
15131513
Namespace: ns.Name,
15141514
},
15151515
}
1516-
g.Expect(env.Create(ctx, testCluster)).To(Succeed())
1516+
g.Expect(env.CreateAndWait(ctx, testCluster)).To(Succeed())
15171517
g.Expect(env.CreateKubeconfigSecret(ctx, testCluster)).To(Succeed())
15181518
defer func(do ...client.Object) {
1519-
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
1520-
}(ns, testCluster)
1519+
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
1520+
}(testCluster)
15211521

15221522
defaultMachinePool := expv1.MachinePool{
15231523
ObjectMeta: metav1.ObjectMeta{
@@ -1593,9 +1593,9 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
15931593
},
15941594
},
15951595
}
1596-
g.Expect(env.Create(ctx, node)).To(Succeed())
1596+
g.Expect(env.CreateAndWait(ctx, node)).To(Succeed())
15971597
defer func(do ...client.Object) {
1598-
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
1598+
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
15991599
}(node)
16001600

16011601
kubeconfigSecret := kubeconfig.GenerateSecret(testCluster, kubeconfig.FromEnvTestConfig(env.Config, testCluster))
@@ -1656,7 +1656,7 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
16561656
}
16571657
g.Expect(env.CreateAndWait(ctx, node)).To(Succeed())
16581658
defer func(do ...client.Object) {
1659-
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
1659+
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
16601660
}(node)
16611661

16621662
kubeconfigSecret := kubeconfig.GenerateSecret(testCluster, kubeconfig.FromEnvTestConfig(env.Config, testCluster))
@@ -1780,9 +1780,9 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
17801780
},
17811781
},
17821782
}
1783-
g.Expect(env.Create(ctx, node)).To(Succeed())
1783+
g.Expect(env.CreateAndWait(ctx, node)).To(Succeed())
17841784
defer func(do ...client.Object) {
1785-
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
1785+
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
17861786
}(node)
17871787

17881788
kubeconfigSecret := kubeconfig.GenerateSecret(testCluster, kubeconfig.FromEnvTestConfig(env.Config, testCluster))

0 commit comments

Comments
 (0)