Skip to content

Commit c1af2b1

Browse files
committed
stembuild: use explict Ginkgo WithTimeout format
1 parent 6ba1d9b commit c1af2b1

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

stembuild/integration/construct/construct_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ var _ = Describe("stembuild construct", func() {
5151
session := helpers.Stembuild(stembuildExecutable, "construct", "-vm-ip", conf.TargetIP, "-vm-username", conf.VMUsername, "-vm-password", conf.VMPassword, "-vcenter-url", conf.VCenterURL, "-vcenter-username", conf.VCenterUsername, "-vcenter-password", conf.VCenterPassword, "-vm-inventory-path", conf.VMInventoryPath, "-vcenter-ca-certs", conf.VCenterCACert)
5252

5353
Eventually(session, shutdownTimeout).Should(Exit(0))
54-
Eventually(session.Out, constructOutputTimeout).Should(Say(`mock stemcell automation script executed`))
54+
Eventually(session.Out).WithTimeout(constructOutputTimeout).Should(Say(`mock stemcell automation script executed`))
5555
})
5656

5757
It("executes post-reboot automation script", func() {
5858
session := helpers.Stembuild(stembuildExecutable, "construct", "-vm-ip", conf.TargetIP, "-vm-username", conf.VMUsername, "-vm-password", conf.VMPassword, "-vcenter-url", conf.VCenterURL, "-vcenter-username", conf.VCenterUsername, "-vcenter-password", conf.VCenterPassword, "-vm-inventory-path", conf.VMInventoryPath, "-vcenter-ca-certs", conf.VCenterCACert)
5959

6060
Eventually(session, shutdownTimeout).Should(Exit(0))
61-
Eventually(session.Out, constructOutputTimeout*5).Should(Say(`mock stemcell automation post-reboot script executed`))
61+
Eventually(session.Out).WithTimeout(constructOutputTimeout * 5).Should(Say(`mock stemcell automation post-reboot script executed`))
6262
})
6363

6464
It("extracts the WinRM BOSH powershell script and executes it successfully on the guest VM", func() {
6565
session := helpers.Stembuild(stembuildExecutable, "construct", "-vm-ip", conf.TargetIP, "-vm-username", conf.VMUsername, "-vm-password", conf.VMPassword, "-vcenter-url", conf.VCenterURL, "-vcenter-username", conf.VCenterUsername, "-vcenter-password", conf.VCenterPassword, "-vm-inventory-path", conf.VMInventoryPath, "-vcenter-ca-certs", conf.VCenterCACert)
6666

6767
Eventually(session, shutdownTimeout).Should(Exit(0))
68-
Eventually(session.Out, constructOutputTimeout).Should(Say(`Attempting to enable WinRM on the guest vm...WinRm enabled on the guest VM`))
68+
Eventually(session.Out).WithTimeout(constructOutputTimeout).Should(Say(`Attempting to enable WinRM on the guest vm...WinRm enabled on the guest VM`))
6969
})
7070
})
7171

stembuild/integration/convert_vmdk_command_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var _ = Describe("Convert VMDK", func() {
3636
inputVmdk = filepath.Join("..", "test", "data", "expected.vmdk")
3737

3838
session := helpers.Stembuild(stembuildExecutable, "package", "--vmdk", inputVmdk)
39-
Eventually(session, 20).Should(Exit(1))
39+
Eventually(session).WithTimeout(20).Should(Exit(1))
4040
Eventually(session.Err).Should(Say(`versioning error; parsed os version is: 9999`))
4141
})
4242

@@ -93,7 +93,7 @@ var _ = Describe("Convert VMDK", func() {
9393

9494
func expectStembuildToSucceed(arguments ...string) *Session {
9595
session := helpers.Stembuild(stembuildExecutable, arguments...)
96-
Eventually(session, 60*time.Second).Should(Exit(0),
96+
Eventually(session).WithTimeout(60*time.Second).Should(Exit(0),
9797
fmt.Sprintf(
9898
"Expected %s %s to exit with code 0, exited with code %d\nout: %s\nerr: %s",
9999
stembuildExecutable,

stembuild/integration/package/package_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ var _ = Describe("Package", func() {
8888
"-vcenter-ca-certs", pathToCACert,
8989
)
9090

91-
Eventually(session, 60*time.Minute, 5*time.Second).Should(gexec.Exit(0))
91+
Eventually(session).WithTimeout(60 * time.Minute).WithPolling(5 * time.Second).Should(gexec.Exit(0))
9292
var out []byte
9393
session.Out.Write(out) //nolint:errcheck
9494
By(fmt.Sprintf("session.Out: '%s'", string(out)))
@@ -143,7 +143,7 @@ var _ = Describe("Package", func() {
143143
"-vcenter-ca-certs", pathToCACert,
144144
)
145145

146-
Eventually(session, 60*time.Minute, 5*time.Second).Should(gexec.Exit(0))
146+
Eventually(session).WithTimeout(60 * time.Minute).WithPolling(5 * time.Second).Should(gexec.Exit(0))
147147
var out []byte
148148
session.Out.Write(out) //nolint:errcheck
149149
By(fmt.Sprintf("session.Out: '%s'", string(out)))

stembuild/integration/version_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ var _ = Describe("Version flag", func() {
2626
It("prints version information", func() {
2727
session := helpers.Stembuild(stembuildExecutable, "--version")
2828

29-
Eventually(session, 20).Should(Exit(0))
29+
Eventually(session).WithTimeout(20).Should(Exit(0))
3030
Eventually(session).Should(Say(expectedVersion))
3131
})
3232

3333
It("with command, prints version information and does not run command", func() {
3434
session := helpers.Stembuild(stembuildExecutable, "--version", "package")
3535

36-
Eventually(session, 20).Should(Exit(0))
36+
Eventually(session).WithTimeout(20).Should(Exit(0))
3737
Eventually(session).Should(Say(expectedVersion))
3838
})
3939
})

stembuild/test/helpers/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func BuildStembuild(version string) (string, error) {
182182
NewPrefixedWriter(DebugOutPrefix, GinkgoWriter),
183183
NewPrefixedWriter(DebugErrPrefix, GinkgoWriter))
184184
Expect(err).NotTo(HaveOccurred())
185-
Eventually(session, 240*time.Second).Should(Exit(0))
185+
Eventually(session).WithTimeout(240 * time.Second).Should(Exit(0))
186186

187187
files, err := os.ReadDir(filepath.Join(root, "out"))
188188
Expect(err).NotTo(HaveOccurred())

0 commit comments

Comments
 (0)