From 9a3c595909848aebc09e110ec7b9744a536de99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandor=20Sz=C3=BCcs?= Date: Tue, 22 Aug 2023 22:25:44 +0200 Subject: [PATCH] fix: test flakyness by changing sleeps and speedup test (#2541) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sandor Szücs --- filters/auth/webhook_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/filters/auth/webhook_test.go b/filters/auth/webhook_test.go index e49841b5e9..e5720caf2f 100644 --- a/filters/auth/webhook_test.go +++ b/filters/auth/webhook_test.go @@ -59,9 +59,10 @@ func TestWebhook(t *testing.T) { })) defer backend.Close() + d := 100 * time.Millisecond authServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if ti.timeout { - time.Sleep(time.Second + time.Millisecond) + time.Sleep(2 * d) } if r.Method != "GET" { @@ -91,7 +92,7 @@ func TestWebhook(t *testing.T) { })) defer authServer.Close() - spec := NewWebhook(time.Second) + spec := NewWebhook(d) args := []interface{}{ "http://" + authServer.Listener.Addr().String(), @@ -103,8 +104,7 @@ func TestWebhook(t *testing.T) { _, err := spec.CreateFilter(args) if err != nil { - t.Errorf("error creating filter for %s: %v", ti.msg, err) - return + t.Fatalf("error creating filter for %s: %v", ti.msg, err) } fr := make(filters.Registry)