Proxy timing tests outlast a hold-up of the test process (closes #53)
check / check (push) Successful in 1m53s

smallwebwaf starts each timeout as the request arrives, before the step
a test needs first: the upgrade answered, the app's buffers full, the
first part of an answer passed on. A hold-up of the test process longer
than the 300 ms timeout ran it out before that step. No test can make
that step come first, and in the "waiting on the app" cases it cannot
see which side smallwebwaf was waiting on, so the timeout is now 5 s,
the hold-up wantTimedOut already allows. The timeout tests set when it
must not run out goes from 10 s to 1 m to stay clear of it. The upgrade
test waits 7.5 s past the upgrade.

Judgement call: one shared value; the proxy tests take about 8 s, not 2 s.

Model: opus-5-5
This commit was merged in pull request #55.
This commit is contained in:
2026-10-04 07:53:18 +02:00
parent d730fcb57d
commit 6977ff73df
2 changed files with 10 additions and 5 deletions
+3 -2
View File
@@ -246,8 +246,9 @@ func TestUpgradedConnectionOutlastsTheTimeouts(t *testing.T) {
t.Fatalf("status %d, want %d", res.StatusCode, http.StatusSwitchingProtocols)
}
// Wait past every timeout, then use the connection.
time.Sleep(3 * shortTimeout)
// Every timeout started before the upgrade was answered: wait past
// them all, then use the connection.
time.Sleep(3 * shortTimeout / 2)
send(t, conn, "still here\n")
echoed, err := reader.ReadString('\n')
+7 -3
View File
@@ -21,11 +21,15 @@ import (
const (
// shortTimeout is what a test sets a timeout to, to see it run out.
shortTimeout = 300 * time.Millisecond
// It starts before the test has set up its case, such as an upgrade
// or the app's buffers filling, so it is as long as the hold-up of the
// test process that wantTimedOut allows, waitLimit/2: a shorter one
// can run out first on a busy host.
shortTimeout = 5 * time.Second
// shortTimeoutSetting is shortTimeout as a setting's value.
shortTimeoutSetting = "300ms"
shortTimeoutSetting = "5s"
// longTimeoutSetting is a timeout that does not run out in a test.
longTimeoutSetting = "10s"
longTimeoutSetting = "1m"
// waitLimit bounds how long a test waits for what should happen.
waitLimit = 10 * time.Second
// pollInterval is how often a test looks for a log line.