Skip to content

Commit 8815e60

Browse files
committed
Fix flaky client timeout test
It looks like the server sleep wasn't always enough to trigger the timeout of the `fail with timeout` test. The server sleep has been increased, and the timeout decreased to prevent this from happening.
1 parent 60c0b0a commit 8815e60

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ca/client_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ func TestClient_GetCaURL(t *testing.T) {
10191019

10201020
func TestClient_WithTimeout(t *testing.T) {
10211021
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
1022-
time.Sleep(100 * time.Millisecond)
1022+
time.Sleep(200 * time.Millisecond)
10231023
render.JSONStatus(w, r, api.HealthResponse{Status: "ok"}, 200)
10241024
}))
10251025
defer srv.Close()
@@ -1030,8 +1030,8 @@ func TestClient_WithTimeout(t *testing.T) {
10301030
assertion assert.ErrorAssertionFunc
10311031
}{
10321032
{"ok", []ClientOption{WithTransport(http.DefaultTransport)}, assert.NoError},
1033-
{"ok with timeout", []ClientOption{WithTransport(http.DefaultTransport), WithTimeout(time.Second)}, assert.NoError},
1034-
{"fail with timeout", []ClientOption{WithTransport(http.DefaultTransport), WithTimeout(100 * time.Millisecond)}, assert.Error},
1033+
{"ok with timeout", []ClientOption{WithTransport(http.DefaultTransport), WithTimeout(5 * time.Second)}, assert.NoError},
1034+
{"fail with timeout", []ClientOption{WithTransport(http.DefaultTransport), WithTimeout(10 * time.Millisecond)}, assert.Error},
10351035
}
10361036

10371037
for _, tt := range tests {

0 commit comments

Comments
 (0)