(t *testing.T)
| 51 | } |
| 52 | |
| 53 | func TestBackOffOverflow(t *testing.T) { |
| 54 | var ( |
| 55 | testInitialInterval time.Duration = math.MaxInt64 / 2 |
| 56 | testMaxInterval time.Duration = math.MaxInt64 |
| 57 | testMultiplier = 2.1 |
| 58 | ) |
| 59 | |
| 60 | exp := NewExponentialBackOff() |
| 61 | exp.InitialInterval = testInitialInterval |
| 62 | exp.Multiplier = testMultiplier |
| 63 | exp.MaxInterval = testMaxInterval |
| 64 | exp.Reset() |
| 65 | |
| 66 | exp.NextBackOff() |
| 67 | // Assert that when an overflow is possible, the current interval time.Duration is set to the max interval time.Duration. |
| 68 | assertEquals(t, testMaxInterval, exp.currentInterval) |
| 69 | } |
| 70 | |
| 71 | func assertEquals(t *testing.T, expected, value time.Duration) { |
| 72 | if expected != value { |
nothing calls this directly
no test coverage detected
searching dependent graphs…