diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index e46c7f5b..8e88ffcc 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -344,11 +344,11 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "816a9b7df678" + "Rev": "4cb0a757333c" }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "6c8691705fc5" + "Rev": "62ce3d1e6a82" }, { "ImportPath": "k8s.io/gengo", diff --git a/go.mod b/go.mod index 3ba0378a..bf734b43 100644 --- a/go.mod +++ b/go.mod @@ -27,8 +27,8 @@ require ( golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c google.golang.org/appengine v1.5.0 // indirect - k8s.io/api v0.0.0-20191016225839-816a9b7df678 - k8s.io/apimachinery v0.0.0-20191020214737-6c8691705fc5 + k8s.io/api v0.0.0-20191024025707-4cb0a757333c + k8s.io/apimachinery v0.0.0-20191024025529-62ce3d1e6a82 k8s.io/klog v1.0.0 k8s.io/utils v0.0.0-20191010214722-8d271d903fe4 sigs.k8s.io/yaml v1.1.0 @@ -42,6 +42,6 @@ replace ( golang.org/x/sys => golang.org/x/sys v0.0.0-20190209173611-3b5209105503 golang.org/x/text => golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db golang.org/x/time => golang.org/x/time v0.0.0-20161028155119-f51c12702a4d - k8s.io/api => k8s.io/api v0.0.0-20191016225839-816a9b7df678 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191020214737-6c8691705fc5 + k8s.io/api => k8s.io/api v0.0.0-20191024025707-4cb0a757333c + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191024025529-62ce3d1e6a82 ) diff --git a/go.sum b/go.sum index bdc70bc5..31d07b5e 100644 --- a/go.sum +++ b/go.sum @@ -180,8 +180,8 @@ gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.0.0-20191016225839-816a9b7df678/go.mod h1:LZQaT8MvVpl7Bg2lYFcQm7+Mpdxq8p1NFl3yh+5DCwY= -k8s.io/apimachinery v0.0.0-20191020214737-6c8691705fc5/go.mod h1:92mWDd8Ji2sw2157KIgino5wCxffA8KSvhW2oY4ypdw= +k8s.io/api v0.0.0-20191024025707-4cb0a757333c/go.mod h1:wThzAkkfqqxz0ERi8QQEOwQfkBFM27QYtPxuvBI9p+0= +k8s.io/apimachinery v0.0.0-20191024025529-62ce3d1e6a82/go.mod h1:92mWDd8Ji2sw2157KIgino5wCxffA8KSvhW2oY4ypdw= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/util/workqueue/delaying_queue.go b/util/workqueue/delaying_queue.go index 3868bcac..e1ab76ea 100644 --- a/util/workqueue/delaying_queue.go +++ b/util/workqueue/delaying_queue.go @@ -35,14 +35,17 @@ type DelayingInterface interface { // NewDelayingQueue constructs a new workqueue with delayed queuing ability func NewDelayingQueue() DelayingInterface { - return newDelayingQueue(clock.RealClock{}, "") + return NewDelayingQueueWithCustomClock(clock.RealClock{}, "") } +// NewNamedDelayingQueue constructs a new named workqueue with delayed queuing ability func NewNamedDelayingQueue(name string) DelayingInterface { - return newDelayingQueue(clock.RealClock{}, name) + return NewDelayingQueueWithCustomClock(clock.RealClock{}, name) } -func newDelayingQueue(clock clock.Clock, name string) DelayingInterface { +// NewDelayingQueueWithCustomClock constructs a new named workqueue +// with ability to inject real or fake clock for testing purposes +func NewDelayingQueueWithCustomClock(clock clock.Clock, name string) DelayingInterface { ret := &delayingType{ Interface: NewNamed(name), clock: clock, diff --git a/util/workqueue/delaying_queue_test.go b/util/workqueue/delaying_queue_test.go index 4e427c6b..2af8ba3a 100644 --- a/util/workqueue/delaying_queue_test.go +++ b/util/workqueue/delaying_queue_test.go @@ -29,7 +29,7 @@ import ( func TestSimpleQueue(t *testing.T) { fakeClock := clock.NewFakeClock(time.Now()) - q := newDelayingQueue(fakeClock, "") + q := NewDelayingQueueWithCustomClock(fakeClock, "") first := "foo" @@ -71,7 +71,7 @@ func TestSimpleQueue(t *testing.T) { func TestDeduping(t *testing.T) { fakeClock := clock.NewFakeClock(time.Now()) - q := newDelayingQueue(fakeClock, "") + q := NewDelayingQueueWithCustomClock(fakeClock, "") first := "foo" @@ -130,7 +130,7 @@ func TestDeduping(t *testing.T) { func TestAddTwoFireEarly(t *testing.T) { fakeClock := clock.NewFakeClock(time.Now()) - q := newDelayingQueue(fakeClock, "") + q := NewDelayingQueueWithCustomClock(fakeClock, "") first := "foo" second := "bar" @@ -179,7 +179,7 @@ func TestAddTwoFireEarly(t *testing.T) { func TestCopyShifting(t *testing.T) { fakeClock := clock.NewFakeClock(time.Now()) - q := newDelayingQueue(fakeClock, "") + q := NewDelayingQueueWithCustomClock(fakeClock, "") first := "foo" second := "bar" @@ -217,7 +217,7 @@ func TestCopyShifting(t *testing.T) { func BenchmarkDelayingQueue_AddAfter(b *testing.B) { fakeClock := clock.NewFakeClock(time.Now()) - q := newDelayingQueue(fakeClock, "") + q := NewDelayingQueueWithCustomClock(fakeClock, "") // Add items for n := 0; n < b.N; n++ {