diff --git a/internal/proxy/passthrough_test.go b/internal/proxy/passthrough_test.go index c788d1f..8f644bb 100644 --- a/internal/proxy/passthrough_test.go +++ b/internal/proxy/passthrough_test.go @@ -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') diff --git a/internal/proxy/proxy_test.go b/internal/proxy/proxy_test.go index 7b4ebab..c6aefe1 100644 --- a/internal/proxy/proxy_test.go +++ b/internal/proxy/proxy_test.go @@ -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.