MCPcopy
hub / github.com/kubernetes/client-go / TestBackoffHighWaterMark

Function TestBackoffHighWaterMark

util/flowcontrol/backoff_test.go:78–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func 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
100func TestBackoffGC(t *testing.T) {
101 id := "_idGC"

Callers

nothing calls this directly

Calls 5

NewFakeBackOffFunction · 0.85
NowMethod · 0.65
NextMethod · 0.65
GetMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected