Refactor util clock into it's own pkg
This commit is contained in:
8
pkg/kubelet/util/cache/object_cache_test.go
vendored
8
pkg/kubelet/util/cache/object_cache_test.go
vendored
@@ -22,7 +22,7 @@ import (
|
||||
"time"
|
||||
|
||||
expirationCache "k8s.io/kubernetes/pkg/client/cache"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/clock"
|
||||
)
|
||||
|
||||
type testObject struct {
|
||||
@@ -31,7 +31,7 @@ type testObject struct {
|
||||
}
|
||||
|
||||
// A fake objectCache for unit test.
|
||||
func NewFakeObjectCache(f func() (interface{}, error), ttl time.Duration, clock util.Clock) *ObjectCache {
|
||||
func NewFakeObjectCache(f func() (interface{}, error), ttl time.Duration, clock clock.Clock) *ObjectCache {
|
||||
ttlPolicy := &expirationCache.TTLPolicy{Ttl: ttl, Clock: clock}
|
||||
deleteChan := make(chan string, 1)
|
||||
return &ObjectCache{
|
||||
@@ -47,7 +47,7 @@ func TestAddAndGet(t *testing.T) {
|
||||
}
|
||||
objectCache := NewFakeObjectCache(func() (interface{}, error) {
|
||||
return nil, fmt.Errorf("Unexpected Error: updater should never be called in this test!")
|
||||
}, 1*time.Hour, util.NewFakeClock(time.Now()))
|
||||
}, 1*time.Hour, clock.NewFakeClock(time.Now()))
|
||||
|
||||
err := objectCache.Add(testObj.key, testObj.val)
|
||||
if err != nil {
|
||||
@@ -72,7 +72,7 @@ func TestExpirationBasic(t *testing.T) {
|
||||
val: unexpectedVal,
|
||||
}
|
||||
|
||||
fakeClock := util.NewFakeClock(time.Now())
|
||||
fakeClock := clock.NewFakeClock(time.Now())
|
||||
|
||||
objectCache := NewFakeObjectCache(func() (interface{}, error) {
|
||||
return expectedVal, nil
|
||||
|
||||
Reference in New Issue
Block a user