@@ -260,29 +260,30 @@ func TestTaintTolerationScore(t *testing.T) {
260260}
261261
262262func TestTaintTolerationFilter (t * testing.T ) {
263- unschedulable := framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonNotMatch )
264263 tests := []struct {
265264 name string
266265 pod * v1.Pod
267266 node * v1.Node
268267 wantStatus * framework.Status
269268 }{
270269 {
271- name : "A pod having no tolerations can't be scheduled onto a node with nonempty taints" ,
272- pod : podWithTolerations ("pod1" , []v1.Toleration {}),
273- node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
274- wantStatus : unschedulable ,
270+ name : "A pod having no tolerations can't be scheduled onto a node with nonempty taints" ,
271+ pod : podWithTolerations ("pod1" , []v1.Toleration {}),
272+ node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
273+ wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable ,
274+ "node(s) had taint {dedicated: user1}, that the pod didn't tolerate" ),
275275 },
276276 {
277277 name : "A pod which can be scheduled on a dedicated node assigned to user1 with effect NoSchedule" ,
278278 pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
279279 node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
280280 },
281281 {
282- name : "A pod which can't be scheduled on a dedicated node assigned to user2 with effect NoSchedule" ,
283- pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "dedicated" , Operator : "Equal" , Value : "user2" , Effect : "NoSchedule" }}),
284- node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
285- wantStatus : unschedulable ,
282+ name : "A pod which can't be scheduled on a dedicated node assigned to user2 with effect NoSchedule" ,
283+ pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "dedicated" , Operator : "Equal" , Value : "user2" , Effect : "NoSchedule" }}),
284+ node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
285+ wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable ,
286+ "node(s) had taint {dedicated: user1}, that the pod didn't tolerate" ),
286287 },
287288 {
288289 name : "A pod can be scheduled onto the node, with a toleration uses operator Exists that tolerates the taints on the node" ,
@@ -303,9 +304,10 @@ func TestTaintTolerationFilter(t *testing.T) {
303304 {
304305 name : "A pod has a toleration that keys and values match the taint on the node, but (non-empty) effect doesn't match, " +
305306 "can't be scheduled onto the node" ,
306- pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "foo" , Operator : "Equal" , Value : "bar" , Effect : "PreferNoSchedule" }}),
307- node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "foo" , Value : "bar" , Effect : "NoSchedule" }}),
308- wantStatus : unschedulable ,
307+ pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "foo" , Operator : "Equal" , Value : "bar" , Effect : "PreferNoSchedule" }}),
308+ node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "foo" , Value : "bar" , Effect : "NoSchedule" }}),
309+ wantStatus : framework .NewStatus (framework .UnschedulableAndUnresolvable ,
310+ "node(s) had taint {foo: bar}, that the pod didn't tolerate" ),
309311 },
310312 {
311313 name : "The pod has a toleration that keys and values match the taint on the node, the effect of toleration is empty, " +
@@ -315,13 +317,13 @@ func TestTaintTolerationFilter(t *testing.T) {
315317 },
316318 {
317319 name : "The pod has a toleration that key and value don't match the taint on the node, " +
318- "but the effect of taint on node is PreferNochedule . Pod can be scheduled onto the node" ,
320+ "but the effect of taint on node is PreferNoSchedule . Pod can be scheduled onto the node" ,
319321 pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "dedicated" , Operator : "Equal" , Value : "user2" , Effect : "NoSchedule" }}),
320322 node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "PreferNoSchedule" }}),
321323 },
322324 {
323325 name : "The pod has no toleration, " +
324- "but the effect of taint on node is PreferNochedule . Pod can be scheduled onto the node" ,
326+ "but the effect of taint on node is PreferNoSchedule . Pod can be scheduled onto the node" ,
325327 pod : podWithTolerations ("pod1" , []v1.Toleration {}),
326328 node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "PreferNoSchedule" }}),
327329 },
0 commit comments