From dd78c810577c90535b13315c63b59da8031f1dbe Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 22 Jan 2026 12:00:09 +0100 Subject: [PATCH] E2E framework ssh: avoid log spam in runSSHCommand Emitting "error dialing" on each retry spams the test log output even when the tests succeed. Using Eventually also has other advantages (better failure message, support for Gingko progress reports when a test is stuck). --- test/e2e/framework/ssh/ssh.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/e2e/framework/ssh/ssh.go b/test/e2e/framework/ssh/ssh.go index e1931754589..d60cec3c225 100644 --- a/test/e2e/framework/ssh/ssh.go +++ b/test/e2e/framework/ssh/ssh.go @@ -247,16 +247,12 @@ func runSSHCommand(ctx context.Context, cmd, user, host string, signer ssh.Signe Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)}, HostKeyCallback: ssh.InsecureIgnoreHostKey(), } - client, err := ssh.Dial("tcp", host, config) - if err != nil { - err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 20*time.Second, false, func(ctx context.Context) (bool, error) { - fmt.Printf("error dialing %s@%s: '%v', retrying\n", user, host, err) - if client, err = ssh.Dial("tcp", host, config); err != nil { - return false, nil // retrying, error will be logged above - } - return true, nil - }) - } + var client *ssh.Client + err := framework.Gomega().Eventually(ctx, func() error { + c, err := ssh.Dial("tcp", host, config) + client = c + return err + }).WithPolling(5 * time.Second).WithTimeout(20 * time.Second).Should(gomega.Succeed()) if err != nil { return "", "", 0, fmt.Errorf("error getting SSH client to %s@%s: %w", user, host, err) }