Skip to content

Commit a71586f

Browse files
authored
Merge pull request kubernetes#87598 from sureshpalemoni/master
grammar(noun to pod adjective phases) change for pods status in tests
2 parents d52ecd5 + 6da3b70 commit a71586f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

test/e2e/common/security_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ var _ = framework.KubeDescribe("Security Context", func() {
371371

372372
// waitForFailure waits for pod to fail.
373373
func waitForFailure(f *framework.Framework, name string, timeout time.Duration) {
374-
gomega.Expect(e2epod.WaitForPodCondition(f.ClientSet, f.Namespace.Name, name, "success or failure", timeout,
374+
gomega.Expect(e2epod.WaitForPodCondition(f.ClientSet, f.Namespace.Name, name, fmt.Sprintf("%s or %s", v1.PodSucceeded, v1.PodFailed), timeout,
375375
func(pod *v1.Pod) (bool, error) {
376376
switch pod.Status.Phase {
377377
case v1.PodFailed:

test/e2e/framework/pod/wait.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ func WaitForPodTerminatedInNamespace(c clientset.Interface, podName, reason, nam
253253
}
254254

255255
// waitForPodSuccessInNamespaceTimeout returns nil if the pod reached state success, or an error if it reached failure or ran too long.
256-
func waitForPodSuccessInNamespaceTimeout(c clientset.Interface, podName string, namespace string, timeout time.Duration) error {
257-
return WaitForPodCondition(c, namespace, podName, "success or failure", timeout, func(pod *v1.Pod) (bool, error) {
256+
func waitForPodSuccessInNamespaceTimeout(c clientset.Interface, podName, namespace string, timeout time.Duration) error {
257+
return WaitForPodCondition(c, namespace, podName, fmt.Sprintf("%s or %s", v1.PodSucceeded, v1.PodFailed), timeout, func(pod *v1.Pod) (bool, error) {
258258
if pod.Spec.RestartPolicy == v1.RestartPolicyAlways {
259259
return true, fmt.Errorf("pod %q will never terminate with a succeeded state since its restart policy is Always", podName)
260260
}
@@ -275,12 +275,12 @@ func waitForPodSuccessInNamespaceTimeout(c clientset.Interface, podName string,
275275
// if the pod Get api returns an error (IsNotFound or other), or if the pod failed with an unexpected reason.
276276
// Typically called to test that the passed-in pod is Pending and Unschedulable.
277277
func WaitForPodNameUnschedulableInNamespace(c clientset.Interface, podName, namespace string) error {
278-
return WaitForPodCondition(c, namespace, podName, "Unschedulable", podStartTimeout, func(pod *v1.Pod) (bool, error) {
278+
return WaitForPodCondition(c, namespace, podName, v1.PodReasonUnschedulable, podStartTimeout, func(pod *v1.Pod) (bool, error) {
279279
// Only consider Failed pods. Successful pods will be deleted and detected in
280280
// waitForPodCondition's Get call returning `IsNotFound`
281281
if pod.Status.Phase == v1.PodPending {
282282
for _, cond := range pod.Status.Conditions {
283-
if cond.Type == v1.PodScheduled && cond.Status == v1.ConditionFalse && cond.Reason == "Unschedulable" {
283+
if cond.Type == v1.PodScheduled && cond.Status == v1.ConditionFalse && cond.Reason == v1.PodReasonUnschedulable {
284284
return true, nil
285285
}
286286
}

test/e2e/framework/pods.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (c *PodClient) mungeSpec(pod *v1.Pod) {
185185
// TODO(random-liu): Move pod wait function into this file
186186
func (c *PodClient) WaitForSuccess(name string, timeout time.Duration) {
187187
f := c.f
188-
gomega.Expect(e2epod.WaitForPodCondition(f.ClientSet, f.Namespace.Name, name, "success or failure", timeout,
188+
gomega.Expect(e2epod.WaitForPodCondition(f.ClientSet, f.Namespace.Name, name, fmt.Sprintf("%s or %s", v1.PodSucceeded, v1.PodFailed), timeout,
189189
func(pod *v1.Pod) (bool, error) {
190190
switch pod.Status.Phase {
191191
case v1.PodFailed:
@@ -202,7 +202,7 @@ func (c *PodClient) WaitForSuccess(name string, timeout time.Duration) {
202202
// WaitForFinish waits for pod to finish running, regardless of success or failure.
203203
func (c *PodClient) WaitForFinish(name string, timeout time.Duration) {
204204
f := c.f
205-
gomega.Expect(e2epod.WaitForPodCondition(f.ClientSet, f.Namespace.Name, name, "success or failure", timeout,
205+
gomega.Expect(e2epod.WaitForPodCondition(f.ClientSet, f.Namespace.Name, name, fmt.Sprintf("%s or %s", v1.PodSucceeded, v1.PodFailed), timeout,
206206
func(pod *v1.Pod) (bool, error) {
207207
switch pod.Status.Phase {
208208
case v1.PodFailed:

0 commit comments

Comments
 (0)