Proxy timing tests outlast a hold-up of the test process #55
@@ -246,8 +246,9 @@ func TestUpgradedConnectionOutlastsTheTimeouts(t *testing.T) {
|
|||||||
t.Fatalf("status %d, want %d", res.StatusCode, http.StatusSwitchingProtocols)
|
t.Fatalf("status %d, want %d", res.StatusCode, http.StatusSwitchingProtocols)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait past every timeout, then use the connection.
|
// Every timeout started before the upgrade was answered: wait past
|
||||||
time.Sleep(3 * shortTimeout)
|
// them all, then use the connection.
|
||||||
|
time.Sleep(3 * shortTimeout / 2)
|
||||||
send(t, conn, "still here\n")
|
send(t, conn, "still here\n")
|
||||||
|
|
||||||
echoed, err := reader.ReadString('\n')
|
echoed, err := reader.ReadString('\n')
|
||||||
|
|||||||
@@ -21,11 +21,15 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// shortTimeout is what a test sets a timeout to, to see it run out.
|
// 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 is shortTimeout as a setting's value.
|
||||||
shortTimeoutSetting = "300ms"
|
shortTimeoutSetting = "5s"
|
||||||
// longTimeoutSetting is a timeout that does not run out in a test.
|
// 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 bounds how long a test waits for what should happen.
|
||||||
waitLimit = 10 * time.Second
|
waitLimit = 10 * time.Second
|
||||||
// pollInterval is how often a test looks for a log line.
|
// pollInterval is how often a test looks for a log line.
|
||||||
|
|||||||
Reference in New Issue
Block a user