From c8f8f66e6de188ea1e257f992d047f8a4d38cc5a Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Fri, 8 Aug 2025 08:08:07 +0200 Subject: [PATCH] Increase termination timeout for `evicted pods should be terminal` test This doubles the termination timeout for the eviction test from 5min to 10min. Reason for that is that the eviction manager relies on pod stats metrics, which may not be acceessible during a period of time because of the kubelet API unreachable. This could be reasoned in hardware or network pressure when multiple tests run in parallel. Signed-off-by: Sascha Grunert --- test/e2e/framework/pod/wait.go | 14 ++++++++++++-- test/e2e/node/pods.go | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/test/e2e/framework/pod/wait.go b/test/e2e/framework/pod/wait.go index d7067be28c3..f2f1dba1fcb 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 dd8528bcf74..fad2545c199 100644 --- a/test/e2e/node/pods.go +++ b/test/e2e/node/pods.go @@ -338,7 +338,8 @@ 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) + // Intentionally increase the timeout to ensure the metrics availability required for this test. + err := e2epod.WaitForPodTerminatedInNamespaceTimeout(ctx, f.ClientSet, pod.Name, "Evicted", f.Namespace.Name, 10*time.Minute) if err != nil { framework.Failf("error waiting for pod to be evicted: %v", err) }