Fix flaky context error test.

This commit is contained in:
mikestefanello 2023-11-15 20:14:00 -05:00
parent 524d1a4915
commit 11f5ddcee4

View file

@ -15,8 +15,8 @@ func TestIsCanceled(t *testing.T) {
cancel() cancel()
assert.True(t, IsCanceledError(ctx.Err())) assert.True(t, IsCanceledError(ctx.Err()))
ctx, cancel = context.WithTimeout(context.Background(), time.Microsecond) ctx, cancel = context.WithTimeout(context.Background(), time.Microsecond*5)
time.Sleep(time.Microsecond * 5) <-ctx.Done()
cancel() cancel()
assert.False(t, IsCanceledError(ctx.Err())) assert.False(t, IsCanceledError(ctx.Err()))