(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestBackoffHighWaterMark(t *testing.T) { |
| 79 | id := "_idHiWaterMark" |
| 80 | tc := clock.NewFakeClock(time.Now()) |
| 81 | step := time.Second |
| 82 | maxDuration := 5 * step |
| 83 | b := NewFakeBackOff(step, maxDuration, tc) |
| 84 | |
| 85 | // get to backoff = maxDuration |
| 86 | for i := 0; i <= int(maxDuration/step); i++ { |
| 87 | tc.Step(step) |
| 88 | b.Next(id, tc.Now()) |
| 89 | } |
| 90 | |
| 91 | // backoff high watermark expires after 2*maxDuration |
| 92 | tc.Step(maxDuration + step) |
| 93 | b.Next(id, tc.Now()) |
| 94 | |
| 95 | if b.Get(id) != maxDuration { |
| 96 | t.Errorf("expected Backoff to stay at high watermark %s got %s", maxDuration, b.Get(id)) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func TestBackoffGC(t *testing.T) { |
| 101 | id := "_idGC" |
nothing calls this directly
no test coverage detected