mirror of https://github.com/garrytan/gstack.git
test: make the Darwin migration path and the query-timeout SKIP deterministic on Linux CI
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.
This commit is contained in:
parent
cac9888831
commit
b972cedff7
|
|
@ -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" };
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue