@@ -71,18 +71,18 @@ func TestTaintBasedEvictions(t *testing.T) {
71
71
}
72
72
tolerationSeconds := []int64 {200 , 300 , 0 }
73
73
tests := []struct {
74
- name string
75
- nodeTaints []v1.Taint
76
- nodeConditions []v1.NodeCondition
77
- pod * v1.Pod
78
- waitForPodCondition string
74
+ name string
75
+ nodeTaints []v1.Taint
76
+ nodeConditions []v1.NodeCondition
77
+ pod * v1.Pod
78
+ expectedWaitForPodCondition string
79
79
}{
80
80
{
81
- name : "Taint based evictions for NodeNotReady and 200 tolerationseconds" ,
82
- nodeTaints : []v1.Taint {{Key : v1 .TaintNodeNotReady , Effect : v1 .TaintEffectNoExecute }},
83
- nodeConditions : []v1.NodeCondition {{Type : v1 .NodeReady , Status : v1 .ConditionFalse }},
84
- pod : testPod ,
85
- waitForPodCondition : "updated with tolerationSeconds of 200" ,
81
+ name : "Taint based evictions for NodeNotReady and 200 tolerationseconds" ,
82
+ nodeTaints : []v1.Taint {{Key : v1 .TaintNodeNotReady , Effect : v1 .TaintEffectNoExecute }},
83
+ nodeConditions : []v1.NodeCondition {{Type : v1 .NodeReady , Status : v1 .ConditionFalse }},
84
+ pod : testPod ,
85
+ expectedWaitForPodCondition : "updated with tolerationSeconds of 200" ,
86
86
},
87
87
{
88
88
name : "Taint based evictions for NodeNotReady with no pod tolerations" ,
@@ -96,14 +96,14 @@ func TestTaintBasedEvictions(t *testing.T) {
96
96
},
97
97
},
98
98
},
99
- waitForPodCondition : "updated with tolerationSeconds=300" ,
99
+ expectedWaitForPodCondition : "updated with tolerationSeconds=300" ,
100
100
},
101
101
{
102
- name : "Taint based evictions for NodeNotReady and 0 tolerationseconds" ,
103
- nodeTaints : []v1.Taint {{Key : v1 .TaintNodeNotReady , Effect : v1 .TaintEffectNoExecute }},
104
- nodeConditions : []v1.NodeCondition {{Type : v1 .NodeReady , Status : v1 .ConditionFalse }},
105
- pod : testPod ,
106
- waitForPodCondition : "terminating" ,
102
+ name : "Taint based evictions for NodeNotReady and 0 tolerationseconds" ,
103
+ nodeTaints : []v1.Taint {{Key : v1 .TaintNodeNotReady , Effect : v1 .TaintEffectNoExecute }},
104
+ nodeConditions : []v1.NodeCondition {{Type : v1 .NodeReady , Status : v1 .ConditionFalse }},
105
+ pod : testPod ,
106
+ expectedWaitForPodCondition : "terminating" ,
107
107
},
108
108
{
109
109
name : "Taint based evictions for NodeUnreachable" ,
@@ -281,7 +281,7 @@ func TestTaintBasedEvictions(t *testing.T) {
281
281
}
282
282
283
283
if test .pod != nil {
284
- err = waitForPodCondition (cs , testCtx .NS .Name , test .pod .Name , test .waitForPodCondition , time .Second * 15 , func (pod * v1.Pod ) (bool , error ) {
284
+ err = waitForPodCondition (cs , testCtx .NS .Name , test .pod .Name , test .expectedWaitForPodCondition , time .Second * 15 , func (pod * v1.Pod ) (bool , error ) {
285
285
// as node is unreachable, pod0 is expected to be in Terminating status
286
286
// rather than getting deleted
287
287
if tolerationSeconds [i ] == 0 {
@@ -294,7 +294,7 @@ func TestTaintBasedEvictions(t *testing.T) {
294
294
}, t )
295
295
if err != nil {
296
296
pod , _ := cs .CoreV1 ().Pods (testCtx .NS .Name ).Get (context .TODO (), test .pod .Name , metav1.GetOptions {})
297
- t .Fatalf ("Error: %v, Expected test pod to be %s but it's %v" , err , test .waitForPodCondition , pod )
297
+ t .Fatalf ("Error: %v, Expected test pod to be %s but it's %v" , err , test .expectedWaitForPodCondition , pod )
298
298
}
299
299
testutils .CleanupPods (cs , t , []* v1.Pod {test .pod })
300
300
}
0 commit comments