Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions test/e2e/fixtures/yaml/podvm/podvm.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
11 changes: 10 additions & 1 deletion test/e2e/vmservice/vmservice/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand Down
Loading