Make scheduler optimistic about its bindings
This commit is contained in:
@@ -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"},
|
||||
|
Reference in New Issue
Block a user