mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-07 00:23:44 +08:00
🐞 Make integration tests more robust
I'd assert that the server had exited with a 1 (error condition) when it couldn't bind via UDP to any addresses; however, I wrote the expectation wrong, and sometimes the server hadn't exited by the time I made the assertion, resulting in an exit code of -1 (not yet exited) instead of 1. Using an async assertion `Eventually()`, with a switch `ExitCode()` → `Exit()`, fixes that problem. Fixes, during `ginkgo -r -p`: ``` [FAILED] Expected <int>: -1 to equal <int>: 1 In [It] at: /home/cunnie/workspace/sslip.io/src/sslip.io-dns-server/integration_test.go:400 @ 10/02/23 03:58:15.824 ```
This commit is contained in:
@@ -397,7 +397,7 @@ var _ = Describe("sslip.io-dns-server", func() {
|
||||
secondServerSession, err := Start(secondServerCmd, GinkgoWriter, GinkgoWriter)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Eventually(secondServerSession.Err, 10).Should(Say("I couldn't bind via UDP to any IPs"))
|
||||
Expect(secondServerSession.ExitCode()).To(Equal(1))
|
||||
Eventually(secondServerSession).Should(Exit(1))
|
||||
})
|
||||
})
|
||||
When("it can't bind to any TCP port", func() {
|
||||
|
Reference in New Issue
Block a user