mirror of
https://github.com/redis/go-redis.git
synced 2025-10-20 09:52:25 +03:00
fix(test): fix flaky test
This commit is contained in:
@@ -497,9 +497,14 @@ func TestDialerRetryConfiguration(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Should have attempted 5 times (default DialerRetries = 5)
|
// Should have attempted 5 times (default DialerRetries = 5)
|
||||||
|
// Note: There may be one additional attempt from tryDial() goroutine
|
||||||
|
// which is launched when dialErrorsNum reaches PoolSize
|
||||||
finalAttempts := atomic.LoadInt64(&attempts)
|
finalAttempts := atomic.LoadInt64(&attempts)
|
||||||
if finalAttempts != 5 {
|
if finalAttempts < 5 {
|
||||||
t.Errorf("Expected 5 dial attempts (default), got %d", finalAttempts)
|
t.Errorf("Expected at least 5 dial attempts (default), got %d", finalAttempts)
|
||||||
|
}
|
||||||
|
if finalAttempts > 6 {
|
||||||
|
t.Errorf("Expected around 5 dial attempts, got %d (too many)", finalAttempts)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user