Skip to content

Commit c0b33d5

Browse files
arampricemkocher
authored andcommitted
Stembuild specs: use Eventually() instead of Sleep
We now check for successful execution for 1 minute rather than sleeping for 10 seconds and hoping that the VM is up and the guest-tools are accepting connections. Signed-off-by: Matthew Kocher <[email protected]>
1 parent e12e82b commit c0b33d5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

stembuild/iaas_cli/iaas_clients/vcenter_govmomi_contract_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ var _ = Describe("VcenterClient", func() {
4949
guestManager, err := vCenterManager.GuestManager(ctx, opsManager, envMustExist(TestVmUsername), envMustExist(TestVmPassword))
5050
Expect(err).ToNot(HaveOccurred())
5151

52-
time.Sleep(10 * time.Second)
53-
54-
pid, err := guestManager.StartProgramInGuest(ctx, powershell, "Exit 59")
55-
Expect(err).ToNot(HaveOccurred())
52+
var pid int64
53+
Eventually(func() error {
54+
var startProgramErr error
55+
pid, startProgramErr = guestManager.StartProgramInGuest(ctx, powershell, "Exit 59")
56+
return startProgramErr
57+
}).WithTimeout(1 * time.Minute).Should(Succeed())
5658

5759
exitCode, err := guestManager.ExitCodeForProgramInGuest(ctx, pid)
5860
Expect(err).ToNot(HaveOccurred())

0 commit comments

Comments
 (0)