From b972cedff73b89e8a0a9e1ea53755a7c1a410167 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sat, 15 Aug 2026 11:24:27 -0700 Subject: [PATCH] test: make the Darwin migration path and the query-timeout SKIP deterministic on Linux CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1.65 migration suite relied on the host being macOS — on the ubicloud runner the script's uname gate early-exited every test with empty output; a Darwin uname shim in the shared setup runs the real path everywhere (the non-Darwin test still overrides it with Linux). The 1ms-budget brain-context test assumed 1ms is always too short; the runner's fake gbrain answered in 0ms and no SKIP printed — the fake now sleeps 300ms so the timeout is a certainty, while --version stays instant for the detection assertion. --- test/gstack-brain-context-load.test.ts | 20 +++++++++++++++++++- test/migrations-v1.65.0.0.test.ts | 7 +++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/test/gstack-brain-context-load.test.ts b/test/gstack-brain-context-load.test.ts index b601cd798..5b9337fd8 100644 --- a/test/gstack-brain-context-load.test.ts +++ b/test/gstack-brain-context-load.test.ts @@ -363,7 +363,25 @@ gbrain: const dir = mkdtempSync(join(tmpdir(), "gstack-bcl-")); const binDir = join(dir, "bin"); mkdirSync(binDir); - writeFakeGbrain(binDir); + // A SLOW fake, not the shared instant one: on a fast CI runner the + // instant fake answered inside even a 1ms budget (observed dur=0ms on + // ubicloud) and no SKIP ever printed. Sleeping makes the timeout + // deterministic on every machine; --version stays instant so detection + // has nothing to wait on. + const fakeBin = join(binDir, "gbrain"); + writeFileSync( + fakeBin, + `#!/bin/sh +if [ "$1" = "--version" ]; then + echo "gbrain 0.test" +else + sleep 0.3 + echo "fake gbrain $*" +fi +`, + "utf-8", + ); + chmodSync(fakeBin, 0o755); try { const env = { ...prependPath(binDir), GSTACK_BRAIN_TIMEOUT_MS: "1" }; diff --git a/test/migrations-v1.65.0.0.test.ts b/test/migrations-v1.65.0.0.test.ts index 3be29185e..554120513 100644 --- a/test/migrations-v1.65.0.0.test.ts +++ b/test/migrations-v1.65.0.0.test.ts @@ -109,6 +109,13 @@ beforeEach(() => { pwCache = path.join(tmpHome, 'pw-cache', 'ms-playwright'); fs.mkdirSync(pwCache, { recursive: true }); fs.mkdirSync(path.join(tmpHome, '.gstack'), { recursive: true }); + // The migration gates on `uname -s` = Darwin; on the Linux CI runner the + // real uname made every test early-exit with empty output. Shim Darwin so + // the Darwin-path tests run everywhere; the non-Darwin test overwrites + // this shim with its own Linux uname. + fs.writeFileSync(path.join(fakeBinDir, 'uname'), '#!/bin/bash\necho Darwin\n', { + mode: 0o755, + }); }); afterEach(() => {