mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-07 00:23:44 +08:00
Improve test parallelization w/ nodes > 8
Parallelizable tests (`ginkgo -r -p .`) were failing on my 20-core (`-nodes=20`) Mac Studio. We narrowed this down to two causes: 1. The servers sometimes took longer than the hard-coded 3-second delay to become ready to answer queries. 2. The blocklist was downloaded asynchronously, and sometimes weren't ready by the time the queries were run. To address these, we did the following: 1. Rather than hard-code a 3-second delay, we modified the server to signal that it's ready to answer queries (by printing "Ready to answer queries" to the log). We now wait for that string to appear before we begin testing the server. IMHO, this is a much better solution than a hard-coded delay. 2. The initial download of the blocklist occurs synchronously, and subsequent downloads, asynchronously. Drive-bys: - If the server can't bind to even one address, it exits. - Refactored the blocklist code; the nested if-then-else were too deep Fixes: ``` Expected <string>: 43.134.66.67 to match regular expression <string>: \A52.0.56.137\n\z In [It] at: /Users/cunnie/workspace/sslip.io/src/sslip.io-dns-server/integration_test.go:421 ```
This commit is contained in:
@@ -29,8 +29,8 @@ var _ = BeforeSuite(func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// 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 container-on-a-VM-with-shared-core
|
||||
time.Sleep(3 * time.Second) // takes 0.455s to start up on macOS Big Sur 4-core Xeon
|
||||
// 10 seconds should be long enough for slow container-on-a-VM-with-shared-core
|
||||
Eventually(serverSession.Err, 10).Should(Say("Ready to answer queries"))
|
||||
})
|
||||
|
||||
var _ = AfterSuite(func() {
|
||||
|
Reference in New Issue
Block a user