diff --git a/e2e/framework/command.go b/e2e/framework/command.go index 7e84b51e8..5f2a53a43 100644 --- a/e2e/framework/command.go +++ b/e2e/framework/command.go @@ -401,10 +401,8 @@ func (f *Framework) DevsySSHGpgTestKey(ctx context.Context, workspace string) er } func (f *Framework) DevsyPortTest(ctx context.Context, port string, workspace string) error { - // First run to trigger the first forwarding - _, _, err := f.ExecCommandCapture(ctx, []string{ - "ssh", - "--forward-ports", port, workspace, + _, err := execWithSSHRetry(ctx, workspace, func(ctx context.Context) (string, string, error) { + return f.ExecCommandCapture(ctx, []string{"ssh", "--forward-ports", port, workspace}) }) return err } diff --git a/e2e/framework/retry.go b/e2e/framework/retry.go index fec0e9b79..4c25a5e10 100644 --- a/e2e/framework/retry.go +++ b/e2e/framework/retry.go @@ -51,6 +51,7 @@ var retryableSSHPatterns = []string{ "no such container", "connection timed out", "broken pipe", + "workspace not found", } // isRetryableSSHError returns true when the error indicates a transient SSH diff --git a/e2e/framework/retry_test.go b/e2e/framework/retry_test.go index 836dd70a2..4b7c3e719 100644 --- a/e2e/framework/retry_test.go +++ b/e2e/framework/retry_test.go @@ -61,6 +61,16 @@ func TestIsRetryableSSHError_ConnectionTimedOut(t *testing.T) { ) } +func TestIsRetryableSSHError_WorkspaceNotFound(t *testing.T) { + assert.True( + t, + isRetryableSSHError( + exitError(t, "1"), + "workspace not found for args: [/tmp/temp-XXXXXXX]", + ), + ) +} + func TestIsRetryableSSHError_ExitCode1_NoSSHPattern(t *testing.T) { // Remote command failure (e.g. cat on missing file) — should NOT be retried. assert.False(