🐞 Integration tests work properly on slow machines

The integration tests were failing on my laptop.

As a side note, it's interesting that a 2013 desktop is almost three times
faster than a 2020 laptop. Sic transit gloria mundi.

Drive-by: I removed a `JustBeforeEach()` clause that wasn't being used,
and removed a comment that no longer applied (we no longer need to stop
`systemd-resolved`)
This commit is contained in:
Brian Cunnie
2021-10-03 13:46:20 +01:00
parent 502a6901cc
commit c74792b588

View File

@@ -26,10 +26,12 @@ var _ = Describe("sslip.io-dns-server", func() {
Expect(err).ToNot(HaveOccurred())
serverCmd = exec.Command(serverPath)
serverSession, err = Start(serverCmd, GinkgoWriter, GinkgoWriter)
// "sudo systemctl sudo systemctl stop systemd-resolved" and then try again
// TODO: bind to unprivileged port (NOT 53) for non-macOS users (e.g. port 35353)
Expect(err).ToNot(HaveOccurred())
time.Sleep(455 * time.Millisecond) // takes 0.455s to start up on macOS Big Sur 4-core Xeon
// takes 0.455s to start up on macOS Big Sur 3.7 GHz Quad Core 22-nm Xeon E5-1620v2 processor (2013 Mac Pro)
// takes 1.312s to start up on macOS Big Sur 2.0GHz quad-core 10th-generation Intel Core i5 processor (2020 13" MacBook Pro)
// round up to 3 seconds to account for slow machines
time.Sleep(3 * time.Second) // takes 0.455s to start up on macOS Big Sur 4-core Xeon
})
AfterSuite(func() {
@@ -37,13 +39,6 @@ var _ = Describe("sslip.io-dns-server", func() {
Eventually(serverSession).Should(Exit())
})
JustBeforeEach(func() {
args := strings.Split(digArgs, " ")
digCmd = exec.Command("dig", args...)
digSession, err = Start(digCmd, GinkgoWriter, GinkgoWriter)
Expect(err).ToNot(HaveOccurred())
})
Describe("Integration tests", func() {
DescribeTable("when the DNS server is queried",
func(digArgs string, digResults string, serverLogMessage string) {