Skip to content

Commit f3ee023

Browse files
alexshtinmeiliang86
authored andcommitted
Increase timeout values to prevent test flakiness (#165)
1 parent a94ee70 commit f3ee023

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

internal/common/backoff/retry_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,27 @@ func TestRetrySuccess(t *testing.T) {
5454

5555
func TestNoRetryAfterContextDone(t *testing.T) {
5656
t.Parallel()
57-
i := 0
57+
retryCounter := 0
5858
op := func() error {
59-
i++
59+
retryCounter++
6060

61-
if i == 5 {
61+
if retryCounter == 5 {
6262
return nil
6363
}
6464

6565
return &someError{}
6666
}
6767

68-
policy := NewExponentialRetryPolicy(1 * time.Millisecond)
69-
policy.SetMaximumInterval(5 * time.Millisecond)
68+
policy := NewExponentialRetryPolicy(10 * time.Millisecond)
69+
policy.SetMaximumInterval(50 * time.Millisecond)
7070
policy.SetMaximumAttempts(10)
7171

72-
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*5)
72+
ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond)
7373
defer cancel()
7474

7575
err := Retry(ctx, op, policy, nil)
7676
assert.Error(t, err)
77-
assert.True(t, i >= 2) // verify that we did retry
77+
assert.True(t, retryCounter >= 2, "retryCounter should be at least 2 but was %d", retryCounter) // verify that we did retry
7878
}
7979

8080
func TestRetryFailed(t *testing.T) {

0 commit comments

Comments
 (0)