diff --git a/test/e2e/fixtures/yaml/podvm/podvm.yaml.in b/test/e2e/fixtures/yaml/podvm/podvm.yaml.in index d5d88195a8..48e7f76f0e 100644 --- a/test/e2e/fixtures/yaml/podvm/podvm.yaml.in +++ b/test/e2e/fixtures/yaml/podvm/podvm.yaml.in @@ -42,8 +42,21 @@ spec: args: - | rm -f /etc/yum.repos.d/photon-updates.repo /etc/yum.repos.d/photon-extras.repo - yum install -y iputils openssh-server sshpass - mkdir /root/.ssh + mkdir -p /root/.ssh + + attempt=0 + max_attempts=10 + until yum install -y iputils openssh-server sshpass >>/root/.install.log 2>&1; do + attempt=$((attempt + 1)) + if [ "$attempt" -ge "$max_attempts" ]; then + echo "yum install failed after ${attempt} attempts" >>/root/.install.log + echo "failed" > /root/.failed + while true; do sleep 30; done + fi + echo "yum install attempt ${attempt} failed, retrying in 15s..." >>/root/.install.log + sleep 15 + done + echo > /root/.completed while true; do sleep 30; done {{- if or .PrivateKeySecretName .CustomUserPrivateKeySecretName }} diff --git a/test/e2e/vmservice/vmservice/util.go b/test/e2e/vmservice/vmservice/util.go index c1b4bc46c3..23129a8c10 100644 --- a/test/e2e/vmservice/vmservice/util.go +++ b/test/e2e/vmservice/vmservice/util.go @@ -678,11 +678,20 @@ func VerifyLoginAndRunCmdsInNSXSetup(ctx context.Context, config *config.E2EConf namespace string, podVMName string, vmIP string, cmds []string, expectedOutput []string) { framework.Logf("will attempt to ssh into %s using jumpbox podvm", vmIP) - Eventually(func() bool { + Eventually(func(g Gomega) bool { stdout, err := clusterProxy.Exec(ctx, "-it", "jumpbox", "-n", namespace, "--", "sshpass", "-V") if err == nil && stdout != nil { return true } + + // The install script on the jumpbox PodVM marks /root/.failed once it gives + // up retrying yum install; fail fast with the real error instead of burning + // the full timeout on a install that will never succeed. + if failMarker, ferr := clusterProxy.Exec(ctx, "jumpbox", "-n", namespace, "--", "cat", "/root/.failed"); ferr == nil && len(failMarker) > 0 { + installLog, _ := clusterProxy.Exec(ctx, "jumpbox", "-n", namespace, "--", "cat", "/root/.install.log") + g.Expect(false).To(BeTrue(), "jumpbox PodVM failed to install sshpass permanently:\n%s", string(installLog)) + } + // The Exec function will output an error message on each failure. // Add a log here to clarify that retries are expected behavior. framework.Logf("sshpass not yet installed on jumpbox PodVM, retrying...")