Skip to content

Commit

Permalink
fix TestReconcileMachinePoolScaleToFromZero flakes
Browse files Browse the repository at this point in the history
Replace env.Create and env.Cleanup with env.CreateAndWait and
env.CleanupAndWait, remove namespace from cleanup.
  • Loading branch information
loktev-d committed Dec 6, 2023
1 parent ef2f673 commit c455919
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions exp/internal/controllers/machinepool_controller_phases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1513,11 +1513,11 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
Namespace: ns.Name,
},
}
g.Expect(env.Create(ctx, testCluster)).To(Succeed())
g.Expect(env.CreateAndWait(ctx, testCluster)).To(Succeed())
g.Expect(env.CreateKubeconfigSecret(ctx, testCluster)).To(Succeed())
defer func(do ...client.Object) {
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
}(ns, testCluster)
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
}(testCluster)

defaultMachinePool := expv1.MachinePool{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -1593,9 +1593,9 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
},
},
}
g.Expect(env.Create(ctx, node)).To(Succeed())
g.Expect(env.CreateAndWait(ctx, node)).To(Succeed())
defer func(do ...client.Object) {
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
}(node)

kubeconfigSecret := kubeconfig.GenerateSecret(testCluster, kubeconfig.FromEnvTestConfig(env.Config, testCluster))
Expand Down Expand Up @@ -1656,7 +1656,7 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
}
g.Expect(env.CreateAndWait(ctx, node)).To(Succeed())
defer func(do ...client.Object) {
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
}(node)

kubeconfigSecret := kubeconfig.GenerateSecret(testCluster, kubeconfig.FromEnvTestConfig(env.Config, testCluster))
Expand Down Expand Up @@ -1780,9 +1780,9 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
},
},
}
g.Expect(env.Create(ctx, node)).To(Succeed())
g.Expect(env.CreateAndWait(ctx, node)).To(Succeed())
defer func(do ...client.Object) {
g.Expect(env.Cleanup(ctx, do...)).To(Succeed())
g.Expect(env.CleanupAndWait(ctx, do...)).To(Succeed())
}(node)

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

0 comments on commit c455919

Please sign in to comment.