From 0879aaf21ddf0f4d8b797a7c37b6a624a5cc2184 Mon Sep 17 00:00:00 2001 From: mikestefanello Date: Wed, 15 Nov 2023 20:14:00 -0500 Subject: [PATCH] Fix flaky context error test. --- pkg/context/context_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/context/context_test.go b/pkg/context/context_test.go index 6a5841d..cee5bc7 100644 --- a/pkg/context/context_test.go +++ b/pkg/context/context_test.go @@ -15,8 +15,8 @@ func TestIsCanceled(t *testing.T) { cancel() assert.True(t, IsCanceledError(ctx.Err())) - ctx, cancel = context.WithTimeout(context.Background(), time.Microsecond) - time.Sleep(time.Microsecond * 5) + ctx, cancel = context.WithTimeout(context.Background(), time.Microsecond*5) + <-ctx.Done() cancel() assert.False(t, IsCanceledError(ctx.Err()))