From 55ec0f2d9dd7a86dc1a487b035e725fd9d12721e Mon Sep 17 00:00:00 2001 From: Tim Allclair Date: Fri, 29 Jul 2022 14:42:45 -0700 Subject: [PATCH 1/2] [e2epod] wait: Don't retry on 50X errors --- test/e2e/framework/pod/wait.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/framework/pod/wait.go b/test/e2e/framework/pod/wait.go index 335ee96e0cf..add50187cfa 100644 --- a/test/e2e/framework/pod/wait.go +++ b/test/e2e/framework/pod/wait.go @@ -713,7 +713,7 @@ func shouldRetry(err error) (retry bool, retryAfter time.Duration) { } // these errors indicate a transient error that should be retried. - if apierrors.IsInternalError(err) || apierrors.IsTimeout(err) || apierrors.IsTooManyRequests(err) { + if apierrors.IsTimeout(err) || apierrors.IsTooManyRequests(err) { return true, 0 } From b289c233943537bca3afa596ec9439c9d85fd4d4 Mon Sep 17 00:00:00 2001 From: Tim Allclair Date: Fri, 29 Jul 2022 14:56:19 -0700 Subject: [PATCH 2/2] [e2epod] wait: Don't override non-timeout errors --- test/e2e/framework/pod/wait.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/e2e/framework/pod/wait.go b/test/e2e/framework/pod/wait.go index add50187cfa..076bdcc525f 100644 --- a/test/e2e/framework/pod/wait.go +++ b/test/e2e/framework/pod/wait.go @@ -276,14 +276,15 @@ func WaitForPodCondition(c clientset.Interface, ns, podName, conditionDesc strin if err == nil { return nil } - if IsTimeout(err) && lastPod != nil { - return TimeoutError(fmt.Sprintf("timed out while waiting for pod %s to be %s", podIdentifier(ns, podName), conditionDesc), - lastPod, - ) - } - if lastPodError != nil { - // If the last API call was an error. - err = lastPodError + if IsTimeout(err) { + if lastPod != nil { + return TimeoutError(fmt.Sprintf("timed out while waiting for pod %s to be %s", podIdentifier(ns, podName), conditionDesc), + lastPod, + ) + } else if lastPodError != nil { + // If the last API call was an error, propagate that instead of the timeout error. + err = lastPodError + } } return maybeTimeoutError(err, "waiting for pod %s to be %s", podIdentifier(ns, podName), conditionDesc) }