Use fake clock in TestGetPodsToSync to fix flake.

This commit is contained in:
Random-Liu
2016-04-29 01:39:46 +00:00
committed by Random-Liu
parent 492762d394
commit 4cca5b2290
4 changed files with 23 additions and 30 deletions

View File

@@ -29,6 +29,7 @@ import (
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/kubelet/util/queue"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
)
// fakePodWorkers runs sync pod function in serial, so we can have
@@ -82,7 +83,7 @@ func createPodWorkers() (*podWorkers, map[types.UID][]string) {
return nil
},
fakeRecorder,
queue.NewBasicWorkQueue(),
queue.NewBasicWorkQueue(&util.RealClock{}),
time.Second,
time.Second,
fakeCache,
@@ -216,7 +217,7 @@ func TestFakePodWorkers(t *testing.T) {
kubeletForRealWorkers := &simpleFakeKubelet{}
kubeletForFakeWorkers := &simpleFakeKubelet{}
realPodWorkers := newPodWorkers(kubeletForRealWorkers.syncPodWithWaitGroup, fakeRecorder, queue.NewBasicWorkQueue(), time.Second, time.Second, fakeCache)
realPodWorkers := newPodWorkers(kubeletForRealWorkers.syncPodWithWaitGroup, fakeRecorder, queue.NewBasicWorkQueue(&util.RealClock{}), time.Second, time.Second, fakeCache)
fakePodWorkers := &fakePodWorkers{kubeletForFakeWorkers.syncPod, fakeCache, t}
tests := []struct {