Skip to content

Commit e2e1b60

Browse files
Updates MachineSet tests to use GenerateName
Use GenerateName when creating MachineSet instances to avoid test flakes. Turs out the DeleteAll call in the cleanup function is async, so occasionally we were seeing test failures where the instance name was being reused, but the previous instance had not deleted yet.
1 parent 47ee741 commit e2e1b60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/controller/machineset/machineset_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ var _ = Describe("MachineSet Reconciler", func() {
9191
By("Setting up the machine set builder")
9292
machineSetBuilder = machinev1resourcebuilder.MachineSet().
9393
WithNamespace(namespace.ObjectMeta.Name).
94-
WithName("foo").
94+
WithGenerateName("foo").
9595
WithReplicas(replicas).
9696
WithLabels(map[string]string{"foo": "bar"})
9797

@@ -151,7 +151,7 @@ var _ = Describe("MachineSet Reconciler", func() {
151151

152152
It("Should set the Paused condition appropriately", func() {
153153
instance := machineSetBuilder.
154-
WithName("baz").
154+
WithGenerateName("baz").
155155
WithLabels(map[string]string{"baz": "bar"}).
156156
Build()
157157

0 commit comments

Comments
 (0)