Skip to content

Commit 6220ab8

Browse files
committed
Add retry logic to TestFlyDeploy_Dockerfile for SSH failures
The test was failing due to transient WireGuard API errors when establishing SSH tunnels: Error: ssh: can't build tunnel: failed to run mutation addWireGuardPeer: server returned a non-200 status code: 500 Changed to use FlyAllowExitFailure instead of Fly, so the EventuallyWithT retry logic can handle these transient failures. The test now retries SSH connections for up to 30 seconds (15 attempts @ 2s intervals). This makes the test more resilient to temporary backend issues while still validating that the deployed app has the correct environment.
1 parent ad76705 commit 6220ab8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/preflight/fly_deploy_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ ENV PREFLIGHT_TEST=true`)
175175
f.Fly("launch --org %s --name %s --region %s --internal-port 80 --ha=false --now", f.OrgSlug(), appName, f.PrimaryRegion())
176176

177177
require.EventuallyWithT(t, func(c *assert.CollectT) {
178-
sshResult := f.Fly("ssh console -C 'printenv PREFLIGHT_TEST'")
178+
// Use FlyAllowExitFailure to handle transient WireGuard API failures (HTTP 500)
179+
sshResult := f.FlyAllowExitFailure("ssh console -C 'printenv PREFLIGHT_TEST'")
180+
if sshResult.ExitCode() != 0 {
181+
assert.Fail(c, "ssh command failed, will retry", "exit code: %d, stderr: %s", sshResult.ExitCode(), sshResult.StdErrString())
182+
return
183+
}
179184
assert.Equal(c, "true", strings.TrimSpace(sshResult.StdOutString()), "expected PREFLIGHT_TEST env var to be set in machine")
180185
}, 30*time.Second, 2*time.Second)
181186
}

0 commit comments

Comments
 (0)