Skip to content

Commit 4738ba5

Browse files
authored
Merge pull request kubernetes#89335 from gavinfish/rename-waitforpodcondition
Rename waitForPodCondition to improve code readability
2 parents cadbfd8 + 9d7dc80 commit 4738ba5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

test/integration/node/lifecycle_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ func TestTaintBasedEvictions(t *testing.T) {
7171
}
7272
tolerationSeconds := []int64{200, 300, 0}
7373
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
7979
}{
8080
{
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",
8686
},
8787
{
8888
name: "Taint based evictions for NodeNotReady with no pod tolerations",
@@ -96,14 +96,14 @@ func TestTaintBasedEvictions(t *testing.T) {
9696
},
9797
},
9898
},
99-
waitForPodCondition: "updated with tolerationSeconds=300",
99+
expectedWaitForPodCondition: "updated with tolerationSeconds=300",
100100
},
101101
{
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",
107107
},
108108
{
109109
name: "Taint based evictions for NodeUnreachable",
@@ -281,7 +281,7 @@ func TestTaintBasedEvictions(t *testing.T) {
281281
}
282282

283283
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) {
285285
// as node is unreachable, pod0 is expected to be in Terminating status
286286
// rather than getting deleted
287287
if tolerationSeconds[i] == 0 {
@@ -294,7 +294,7 @@ func TestTaintBasedEvictions(t *testing.T) {
294294
}, t)
295295
if err != nil {
296296
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)
298298
}
299299
testutils.CleanupPods(cs, t, []*v1.Pod{test.pod})
300300
}

0 commit comments

Comments
 (0)