From 03f9bef6e657881bf25426aa0f2e075bfbad6b94 Mon Sep 17 00:00:00 2001 From: garrytan Date: Wed, 28 Oct 2026 13:48:43 +0000 Subject: [PATCH] test(flaky): ubicloud fake ssh dispatches on the remote command, not on a '-O' in the checkout name (GSTA-139) The fake ssh's *-O* arm, meant for 'ssh -O exit' (whose last argument is the host, so it never matched), caught any remote command whose path held '-O': dest work/ubi-run-O????? whenever mkdtemp's first random character was O. Sync then failed with exit 2 (tar child 141) or every phase exited 0, in about 1.3 s, before UBI_RUN_TIMEOUT could fire: Free Tests 40534568946 (:417, 2) and 40638411165 (:454, 0). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/ubicloud-runner.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/ubicloud-runner.test.ts b/test/ubicloud-runner.test.ts index 4a9e2a04c..bb6e66012 100644 --- a/test/ubicloud-runner.test.ts +++ b/test/ubicloud-runner.test.ts @@ -391,7 +391,6 @@ describe('ubi-runner run, verify and quota against a fake API and a fake ssh', ( 'cmd=${*: -1}\n' + 'printf \'%s\\n\' "$cmd" >> "$root/ssh.log"\n' + 'case "$cmd" in\n' + - ' *-O*) exit 0 ;;\n' + ' *pkill*) echo "$cmd" >> "$root/cancel.log" ;;\n' + ' *captured*) cat > "$root/captured" ;;\n' + ' *"cat > ~/.ubirun-env"*) cat > "$root/ubirun-env" ;;\n' + @@ -458,6 +457,18 @@ describe('ubi-runner run, verify and quota against a fake API and a fake ssh', ( } finally { rmSync(f.root, { recursive: true, force: true }); } }, 60_000); + test('run: the fake ssh dispatches on the remote command, so a checkout whose name holds -O still syncs and runs (GSTA-139)', () => { + const f = fakeVm(); + try { + const checkout = join(f.root, 'ubi-run-O1x2y3'); + mkdirSync(checkout); + const r = run(f, ['run', '--src', checkout, '--', 'make test']); + expect(r.exitCode, r.stderr.toString()).toBe(0); + expect(r.stdout.toString()).toContain('ran: '); + expect(f.ssh()).toContain('tar -xzf - -C work/ubi-run-O1x2y3'); + } finally { rmSync(f.root, { recursive: true, force: true }); } + }, 60_000); + test('run: --pass forwards a named local variable only; UBICLOUD_* and non-names are refused before any API call', () => { const f = fakeVm(); try {