From 92b4ec71fb9a1e90e2d51898b5b8f8deb8141d1d Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Thu, 12 Dec 2024 17:42:41 +0000 Subject: [PATCH] flowcontrol: remove testing dependencies The methods NewFakeClock were using a testing dependency as a parameter, to avoid breaking compatibility and to remove this dependency, just use the clock.Clock interface. If we have to do it again most probable we have chosen other pattern and for sure other names, but now is too late. Kubernetes-commit: 5c283cbb453acac9869b49020f6f999796360729 --- util/flowcontrol/backoff.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/util/flowcontrol/backoff.go b/util/flowcontrol/backoff.go index 899b8e34..7cb46717 100644 --- a/util/flowcontrol/backoff.go +++ b/util/flowcontrol/backoff.go @@ -22,7 +22,6 @@ import ( "time" "k8s.io/utils/clock" - testingclock "k8s.io/utils/clock/testing" ) type backoffEntry struct { @@ -49,7 +48,7 @@ type Backoff struct { maxJitterFactor float64 } -func NewFakeBackOff(initial, max time.Duration, tc *testingclock.FakeClock) *Backoff { +func NewFakeBackOff(initial, max time.Duration, tc clock.Clock) *Backoff { return newBackoff(tc, initial, max, 0.0) } @@ -57,7 +56,7 @@ func NewBackOff(initial, max time.Duration) *Backoff { return NewBackOffWithJitter(initial, max, 0.0) } -func NewFakeBackOffWithJitter(initial, max time.Duration, tc *testingclock.FakeClock, maxJitterFactor float64) *Backoff { +func NewFakeBackOffWithJitter(initial, max time.Duration, tc clock.Clock, maxJitterFactor float64) *Backoff { return newBackoff(tc, initial, max, maxJitterFactor) }