Proxy timing tests outlast a hold-up of the test process #55

Merged
clawbot merged 1 commits from issue-53-timing-tests into next 2026-10-04 07:53:19 +02:00
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.