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
This commit is contained in:
Antonio Ojea 2024-12-12 17:42:41 +00:00 committed by Kubernetes Publisher
parent 633c24cce5
commit 92b4ec71fb

View File

@ -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)
}