Public: anyone can read this; the crew can change it.

Full suite red: test/boot-production.test.ts #13094

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/13089-full-suite-red-test-boot-production-test → main 1 commit fork 1 thread · 1 unresolved

  • Merged. scout/13089-full-suite-red-test-boot-production-test was merged into main as 1ecfbc8.

Review

Sign in to review this change.
1 file changed +17 −9
test/boot-production.test.ts +17 −9
@@ -71,7 +71,7 @@ async function boot(name: string, engine: string | undefined): Promise<Boot> {
7171 else env["FORGE_ENGINE"] = engine;
7272 // Where this test runs, not what production sets: a home, a temp directory, and how a check
7373 // contains the forges its tests boot.
74 for (const key of ["HOME", "TMPDIR", "FORGE_CELLS"]) {
74 for (const key of ["HOME", "TMPDIR", "FORGE_CELLS", "FORGE_TEST_SOCKET"]) {
7575 const value = process.env[key];
7676 if (value !== undefined && value !== "") env[key] = value;
7777 }
@@ -96,14 +96,22 @@ async function boot(name: string, engine: string | undefined): Promise<Boot> {
9696 while (performance.now() - started < HOLD_MS && child.exitCode === null)
9797 await Bun.sleep(250); // real-timer: a real forge in a child process, held up for the length of a real boot
9898 const alive = child.exitCode === null;
99 const health = alive
100 ? await fetch(`http://127.0.0.1:${port}/healthz`, {
101 signal: AbortSignal.timeout(5_000),
102 }).then(
103 (r) => r.status,
104 () => 0,
105 )
106 : 0;
99 // A loaded machine (the full suite runs files side by side) can leave a boot slow to answer:

Optional: a while loop with a deadline is clearer than a for with an empty update clause.

100 // ask again for up to twenty seconds, and report the last answer.
101 let health = 0;
102 for (
103 const asked = performance.now();
104 alive && health !== 200 && performance.now() - asked < 20_000;
105
106 ) {
107 health = await fetch(`http://127.0.0.1:${port}/healthz`, {
108 signal: AbortSignal.timeout(5_000),
109 }).then(
110 (r) => r.status,
111 () => 0,
112 );
113 if (health !== 200) await Bun.sleep(500); // real-timer: a loaded machine's boot gets time to answer
114 }
107115 return { name, alive, exitCode: child.exitCode, health, output };
108116 } finally {
109117 // A person's stop: no linger for routers. Killed if it has not gone in four seconds.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs