From 00a4f67ddf78883bb6e891ec3943de08564e209d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 29 Jun 2021 23:53:23 +0200 Subject: [PATCH] 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 --- pkg/plugins/client_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/plugins/client_test.go b/pkg/plugins/client_test.go index 71a56145fd..f93734d367 100644 --- a/pkg/plugins/client_test.go +++ b/pkg/plugins/client_test.go @@ -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) }