chore: Use standardized test timeouts and delays (#3291)

This commit is contained in:
Mathias Fredriksson
2022-08-01 15:45:05 +03:00
committed by GitHub
parent 3d0febdd90
commit 4730c589fe
25 changed files with 198 additions and 109 deletions

View File

@ -25,6 +25,7 @@ import (
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/coderd/devtunnel"
"github.com/coder/coder/testutil"
)
const (
@ -85,15 +86,15 @@ func TestTunnel(t *testing.T) {
_, _ = io.Copy(io.Discard, res.Body)
return res.StatusCode == http.StatusAccepted
}, time.Minute, time.Second)
}, testutil.WaitShort, testutil.IntervalSlow)
assert.NoError(t, server.Close())
cancelTun()
select {
case <-errCh:
case <-time.After(10 * time.Second):
t.Error("tunnel did not close after 10 seconds")
case <-time.After(testutil.WaitLong):
t.Errorf("tunnel did not close after %s", testutil.WaitLong)
}
}
@ -226,7 +227,7 @@ func (f *fakeTunnelServer) requestHTTP() (*http.Response, error) {
}
client := &http.Client{
Transport: transport,
Timeout: 10 * time.Second,
Timeout: testutil.WaitLong,
}
return client.Get(fmt.Sprintf("http://[%s]:8090", clientIP))
}