Merge pull request #8261 from lavalamp/scheduler

Make scheduler optimistic about its bindings
This commit is contained in:
Prashanth B
2015-05-15 17:06:42 -07:00
2 changed files with 31 additions and 15 deletions

View File

@@ -113,6 +113,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: algorithm.FakeMinionLister(
api.NodeList{Items: []api.Node{{ObjectMeta: api.ObjectMeta{Name: "machine1"}}}},
@@ -139,7 +144,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)
}
@@ -229,7 +234,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
// scheduledPodStore: []
// assumedPods: []
s.scheduleOne()
s.schedule()()
// queuedPodStore: []
// scheduledPodStore: [foo:8080]
// assumedPods: [foo:8080]
@@ -283,7 +288,7 @@ func TestSchedulerForgetAssumedPodAfterDelete(t *testing.T) {
close(called)
})
s.scheduleOne()
s.schedule()()
expectBind = &api.Binding{
ObjectMeta: api.ObjectMeta{Name: "bar"},