From 7ab5bea9613e2b7436ef050f477cbf8710b14254 Mon Sep 17 00:00:00 2001 From: Shyam Jeedigunta Date: Sun, 15 Apr 2018 20:52:59 +0200 Subject: [PATCH] Add ConnectionReset, InternalError, etc also as retryable API errors --- test/utils/create_resources.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/utils/create_resources.go b/test/utils/create_resources.go index 7a1379826e..f92649ac14 100644 --- a/test/utils/create_resources.go +++ b/test/utils/create_resources.go @@ -51,7 +51,16 @@ func RetryWithExponentialBackOff(fn wait.ConditionFunc) error { } func IsRetryableAPIError(err error) bool { - return apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) || apierrs.IsTooManyRequests(err) || utilnet.IsProbableEOF(err) + // These errors may indicate a transient error that we can retry in tests. + if apierrs.IsInternalError(err) || apierrs.IsTimeout(err) || apierrs.IsServerTimeout(err) || + apierrs.IsTooManyRequests(err) || utilnet.IsProbableEOF(err) || utilnet.IsConnectionReset(err) { + return true + } + // If the error sends the Retry-After header, we respect it as an explicit confirmation we should retry. + if _, shouldRetry := apierrs.SuggestsClientDelay(err); shouldRetry { + return true + } + return false } func CreatePodWithRetries(c clientset.Interface, namespace string, obj *v1.Pod) error {