@@ -260,29 +260,30 @@ func TestTaintTolerationScore(t *testing.T) {
260
260
}
261
261
262
262
func TestTaintTolerationFilter (t * testing.T ) {
263
- unschedulable := framework .NewStatus (framework .UnschedulableAndUnresolvable , ErrReasonNotMatch )
264
263
tests := []struct {
265
264
name string
266
265
pod * v1.Pod
267
266
node * v1.Node
268
267
wantStatus * framework.Status
269
268
}{
270
269
{
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" ),
275
275
},
276
276
{
277
277
name : "A pod which can be scheduled on a dedicated node assigned to user1 with effect NoSchedule" ,
278
278
pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
279
279
node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "NoSchedule" }}),
280
280
},
281
281
{
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" ),
286
287
},
287
288
{
288
289
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) {
303
304
{
304
305
name : "A pod has a toleration that keys and values match the taint on the node, but (non-empty) effect doesn't match, " +
305
306
"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" ),
309
311
},
310
312
{
311
313
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) {
315
317
},
316
318
{
317
319
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" ,
319
321
pod : podWithTolerations ("pod1" , []v1.Toleration {{Key : "dedicated" , Operator : "Equal" , Value : "user2" , Effect : "NoSchedule" }}),
320
322
node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "PreferNoSchedule" }}),
321
323
},
322
324
{
323
325
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" ,
325
327
pod : podWithTolerations ("pod1" , []v1.Toleration {}),
326
328
node : nodeWithTaints ("nodeA" , []v1.Taint {{Key : "dedicated" , Value : "user1" , Effect : "PreferNoSchedule" }}),
327
329
},
0 commit comments