Make scheduler optimistic about its bindings

This commit is contained in:
Daniel Smith
2015-05-14 10:55:49 -07:00
parent 8605f43df5
commit 3a7086fd8a
2 changed files with 31 additions and 15 deletions

View File

@@ -112,6 +112,11 @@ func TestScheduler(t *testing.T) {
AssumePodFunc: func(pod *api.Pod) {
gotAssumedPod = pod
},
ForgetPodFunc: func(pod *api.Pod) {
if gotAssumedPod != nil && gotAssumedPod.Name == pod.Name && gotAssumedPod.Namespace == pod.Namespace {
gotAssumedPod = nil
}
},
},
MinionLister: scheduler.FakeMinionLister(
api.NodeList{Items: []api.Node{{ObjectMeta: api.ObjectMeta{Name: "machine1"}}}},
@@ -138,7 +143,7 @@ func TestScheduler(t *testing.T) {
}
close(called)
})
s.scheduleOne()
s.schedule()()
if e, a := item.expectAssumedPod, gotAssumedPod; !reflect.DeepEqual(e, a) {
t.Errorf("%v: assumed pod: wanted %v, got %v", i, e, a)
}
@@ -228,7 +233,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
// scheduledPodStore: []
// assumedPods: []
s.scheduleOne()
s.schedule()()
// queuedPodStore: []
// scheduledPodStore: [foo:8080]
// assumedPods: [foo:8080]
@@ -282,7 +287,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
close(called)
})
s.scheduleOne()
s.schedule()()
expectBind = &api.Binding{
ObjectMeta: api.ObjectMeta{Name: "bar"},