Skip to content

Commit 011ef96

Browse files
committed
fix(test): fix flaky test
1 parent 77c0c73 commit 011ef96

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/pool/pool_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,14 @@ func TestDialerRetryConfiguration(t *testing.T) {
497497
}
498498

499499
// Should have attempted 5 times (default DialerRetries = 5)
500+
// Note: There may be one additional attempt from tryDial() goroutine
501+
// which is launched when dialErrorsNum reaches PoolSize
500502
finalAttempts := atomic.LoadInt64(&attempts)
501-
if finalAttempts != 5 {
502-
t.Errorf("Expected 5 dial attempts (default), got %d", finalAttempts)
503+
if finalAttempts < 5 {
504+
t.Errorf("Expected at least 5 dial attempts (default), got %d", finalAttempts)
505+
}
506+
if finalAttempts > 6 {
507+
t.Errorf("Expected around 5 dial attempts, got %d (too many)", finalAttempts)
503508
}
504509
})
505510
}

0 commit comments

Comments
 (0)