Spend less of make test writing the image and waiting (closes #56)
check / check (push) Failing after 2s
check / check (push) Failing after 2s
The test phase spends most of its time compiling with the race detector from an empty build cache; then come writing the test image and the internal/proxy tests. - Go's build cache is on a tmpfs in the test phase, so its 137 MB are no longer written into the test image. - TestUpgradedConnectionOutlastsTheTimeouts waits until just past shortTimeout after the request was sent, rather than 7.5 s after the upgrade, so it ends with the other timing tests. - shortTimeout is written as waitLimit / 2, as its comment says it is. Model: opus-5-5
This commit is contained in:
@@ -233,6 +233,7 @@ func TestUpgradedConnectionOutlastsTheTimeouts(t *testing.T) {
|
||||
send(t, conn, "GET /socket HTTP/1.1\r\nHost: app\r\n"+
|
||||
"Connection: Upgrade\r\nUpgrade: websocket\r\n\r\n")
|
||||
|
||||
sent := time.Now()
|
||||
reader := bufio.NewReader(conn)
|
||||
|
||||
res, err := http.ReadResponse(reader, nil)
|
||||
@@ -246,9 +247,10 @@ func TestUpgradedConnectionOutlastsTheTimeouts(t *testing.T) {
|
||||
t.Fatalf("status %d, want %d", res.StatusCode, http.StatusSwitchingProtocols)
|
||||
}
|
||||
|
||||
// Every timeout started before the upgrade was answered: wait past
|
||||
// them all, then use the connection.
|
||||
time.Sleep(3 * shortTimeout / 2)
|
||||
// Every timeout started by the time smallwebwaf read the request:
|
||||
// wait until just past shortTimeout after it was sent, then use the
|
||||
// connection.
|
||||
time.Sleep(time.Until(sent.Add(shortTimeout + 100*time.Millisecond)))
|
||||
send(t, conn, "still here\n")
|
||||
|
||||
echoed, err := reader.ReadString('\n')
|
||||
|
||||
Reference in New Issue
Block a user