From e6c25383d2ece549b54544f64a19d10732678e24 Mon Sep 17 00:00:00 2001 From: Samuel K Date: Sat, 25 Apr 2026 11:56:04 -0500 Subject: [PATCH] fix(e2e): add retry logic for transient workspace lookup in port-forward test The port-forward e2e test intermittently fails with "workspace not found" when Docker is under load from concurrent SSH commands. Add "workspace not found" to retryableSSHPatterns and wrap DevsyPortTest in execWithSSHRetry to give it the same 3-attempt backoff other SSH commands use. --- e2e/framework/command.go | 6 ++---- e2e/framework/retry.go | 1 + e2e/framework/retry_test.go | 10 ++++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) 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(