From 56719f83b7b98fe4b407485b7e387d98c5ec8eb4 Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Mon, 23 May 2016 19:46:37 +0000 Subject: [PATCH] when kubectl exec fails to find the container to run a command, it should retry Signed-off-by: Huamin Chen --- test/e2e/framework/framework.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 129a36a2253..fc11b51dbed 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -476,6 +476,12 @@ func kubectlExecWithRetry(namespace string, podName, containerName string, args Logf("Warning: kubectl exec encountered i/o timeout.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes)) continue } + if strings.Contains(strings.ToLower(string(stdErrBytes)), "container not found") { + // Retry on "container not found" errors + Logf("Warning: kubectl exec encountered container not found.\nerr=%v\nstdout=%v\nstderr=%v)", err, string(stdOutBytes), string(stdErrBytes)) + time.Sleep(2 * time.Second) + continue + } } return stdOutBytes, stdErrBytes, err