1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Reduce TestClientWithRequestTimeout flakiness

The test sometimes failed because no error was returned:

    === Failed
    === FAIL: pkg/plugins TestClientWithRequestTimeout (0.00s)
         client_test.go:254: assertion failed: expected an error, got nil: expected error

Possibly caused by a race condition, as the sleep was just 1 ms longer than the timeout;
this patch is increasing the sleep in the response to try to reduce flakiness.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-06-29 23:53:23 +02:00
parent d12fc17073
commit 00a4f67ddf
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -242,7 +242,7 @@ func TestClientWithRequestTimeout(t *testing.T) {
timeout := 1 * time.Millisecond
testHandler := func(w http.ResponseWriter, r *http.Request) {
time.Sleep(timeout + 1*time.Millisecond)
time.Sleep(timeout + 10*time.Millisecond)
w.WriteHeader(http.StatusOK)
}