fix: pre-existing test flakiness in relink.test.ts

The 23 tests in this file all shell out to gstack-config + gstack-relink
(bash scripts doing subprocess work). Under parallel bun test load, those
subprocess spawns contend with other test suites and each test can drift
~200ms past Bun's 5s default timeout, causing 5+ flaky timeouts per run
in the gate-tier ship gate.

Wrap the `test` import to default the per-test timeout to 15s. Explicit
per-test timeouts (third arg) still win, so individual tests can lower
it if needed. No behavior change — only gives subprocess-heavy tests
more headroom under parallel load.

Noticed by /ship pre-flight test run. Unrelated to the main PR fix but
blocking the gate, so fixing as a separate commit per the test ownership
protocol.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-04-16 13:55:46 -07:00
parent dc3df796f1
commit 3c7dc78da5
+7 -1
View File
@@ -1,9 +1,15 @@
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
import { describe, test as _bunTest, expect, beforeEach, afterEach } from 'bun:test';
import { execSync } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
// Every test in this file shells out to gstack-config + gstack-relink (bash scripts
// invoking subprocess work). Under parallel bun test load, subprocess spawn contends
// with other suites and each test can drift ~200ms past the 5s default. Bump to 15s.
const test = ((name: any, fn: any, timeout?: number) =>
_bunTest(name, fn, timeout ?? 15_000)) as typeof _bunTest;
const ROOT = path.resolve(import.meta.dir, '..');
const BIN = path.join(ROOT, 'bin');