From f6682370b1a5b0b26c942b910ca93ebc0ee5ab08 Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Wed, 21 Feb 2024 18:58:01 +0800 Subject: [PATCH] fix flaky ut in TestCause contexthelper_test --- test/utils/ktesting/contexthelper_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/utils/ktesting/contexthelper_test.go b/test/utils/ktesting/contexthelper_test.go index 548f99a975f..8d51581bea9 100644 --- a/test/utils/ktesting/contexthelper_test.go +++ b/test/utils/ktesting/contexthelper_test.go @@ -47,13 +47,13 @@ func TestCause(t *testing.T) { }{ "nothing": { parentCtx: context.Background(), - timeout: 5 * time.Millisecond, + timeout: 10 * time.Millisecond, sleep: time.Millisecond, }, "timeout": { parentCtx: context.Background(), timeout: time.Millisecond, - sleep: 5 * time.Millisecond, + sleep: 10 * time.Millisecond, expectErr: context.Canceled, expectCause: canceledError(timeoutCause), }, @@ -64,7 +64,7 @@ func TestCause(t *testing.T) { return ctx }(), timeout: time.Millisecond, - sleep: 5 * time.Millisecond, + sleep: 10 * time.Millisecond, expectErr: context.Canceled, expectCause: context.Canceled, }, @@ -112,7 +112,7 @@ func TestCause(t *testing.T) { if tt.expectDeadline != 0 { actualDeadline, ok := ctx.Deadline() if assert.True(t, ok, "should have had a deadline") { - assert.InDelta(t, time.Until(actualDeadline), tt.expectDeadline, float64(time.Second), "remaining time till Deadline()") + assert.InDelta(t, time.Until(actualDeadline), tt.expectDeadline, float64(5*time.Second), "remaining time till Deadline()") } } time.Sleep(tt.sleep)