diff --git a/test/e2e/framework/pod/wait.go b/test/e2e/framework/pod/wait.go index d7067be28c30e..f2f1dba1fcb0c 100644 --- a/test/e2e/framework/pod/wait.go +++ b/test/e2e/framework/pod/wait.go @@ -495,13 +495,23 @@ func WaitForPodsWithSchedulingGates(ctx context.Context, c clientset.Interface, return err } -// WaitForPodTerminatedInNamespace returns an error if it takes too long for the pod to terminate, +// WaitForPodTerminatedInNamespace returns an error if it takes too long for the pod to terminate after podStartTimeout, // if the pod Get api returns an error (IsNotFound or other), or if the pod failed (and thus did not // terminate) with an unexpected reason. Typically called to test that the passed-in pod is fully // terminated (reason==""), but may be called to detect if a pod did *not* terminate according to // the supplied reason. func WaitForPodTerminatedInNamespace(ctx context.Context, c clientset.Interface, podName, reason, namespace string) error { - return WaitForPodCondition(ctx, c, namespace, podName, fmt.Sprintf("terminated with reason %s", reason), podStartTimeout, func(pod *v1.Pod) (bool, error) { + return WaitForPodTerminatedInNamespaceTimeout(ctx, c, podName, reason, namespace, podStartTimeout) +} + +// WaitForPodTerminatedInNamespaceTimeout returns an error if it takes too long +// for the pod to terminate after the provided timeout, if the pod Get api +// returns an error (IsNotFound or other), or if the pod failed (and thus did +// not terminate) with an unexpected reason. Typically called to test that the +// passed-in pod is fully terminated (reason==""), but may be called to detect +// if a pod did *not* terminate according to the supplied reason. +func WaitForPodTerminatedInNamespaceTimeout(ctx context.Context, c clientset.Interface, podName, reason, namespace string, timeout time.Duration) error { + return WaitForPodCondition(ctx, c, namespace, podName, fmt.Sprintf("terminated with reason %s", reason), timeout, func(pod *v1.Pod) (bool, error) { // Only consider Failed pods. Successful pods will be deleted and detected in // waitForPodCondition's Get call returning `IsNotFound` if pod.Status.Phase == v1.PodFailed { diff --git a/test/e2e/node/pods.go b/test/e2e/node/pods.go index dd64f5f41a81e..ad4aa817341aa 100644 --- a/test/e2e/node/pods.go +++ b/test/e2e/node/pods.go @@ -338,7 +338,7 @@ var _ = SIGDescribe("Pods Extended", func() { return podClient.Delete(ctx, pod.Name, metav1.DeleteOptions{}) }) - err := e2epod.WaitForPodTerminatedInNamespace(ctx, f.ClientSet, pod.Name, "Evicted", f.Namespace.Name) + err := e2epod.WaitForPodTerminatedInNamespaceTimeout(ctx, f.ClientSet, pod.Name, "Evicted", f.Namespace.Name, 15*time.Minute) if err != nil { framework.Failf("error waiting for pod to be evicted: %v", err) }