Public: anyone can read this; the crew can change it.
Full suite red: test/boot-production.test.ts #12748
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/12733-full-suite-red-test-boot-production-test → main 1 commit fork
1 file
changed +5
−5
test/boot-production.test.ts +5 −5
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | * |
| 11 | 11 | * Here the tree boots in a child process with every variable production |
| 12 | 12 | * sets (`helpers/production-env.ts`: the names, never a value), once for each |
| 13 | * way the engine can be asked for, and each boot must be alive ten seconds | |
| 13 | * way the engine can be asked for, and each boot must be alive eight seconds | |
| 14 | 14 | * later, still answering, having logged no uncaught exception and no Worker |
| 15 | 15 | * it could not start or ask. |
| 16 | 16 | * |
| @@ -28,7 +28,7 @@ import { | ||
| 28 | 28 | } from "./helpers/production-env.ts"; |
| 29 | 29 | |
| 30 | 30 | /** How long a boot must stay up after it is started. */ |
| 31 | const HOLD_MS = 10_000; | |
| 31 | const HOLD_MS = 8_000; | |
| 32 | 32 | const MAIN = join(import.meta.dir, "..", "src", "main.ts"); |
| 33 | 33 | |
| 34 | 34 | /** What no boot may say: a throw nothing caught, or a Worker that could not be started or asked. */ |
| @@ -106,11 +106,11 @@ async function boot(name: string, engine: string | undefined): Promise<Boot> { | ||
| 106 | 106 | : 0; |
| 107 | 107 | return { name, alive, exitCode: child.exitCode, health, output }; |
| 108 | 108 | } finally { |
| 109 | // A person's stop: no linger for routers. Killed if it has not gone in ten seconds. | |
| 109 | // A person's stop: no linger for routers. Killed if it has not gone in four seconds. | |
| 110 | 110 | child.kill("SIGINT"); |
| 111 | 111 | const gone = await Promise.race([ |
| 112 | 112 | child.exited.then(() => true), |
| 113 | Bun.sleep(10_000).then(() => false), // real-timer: how long a real child gets to stop before it is killed | |
| 113 | Bun.sleep(4_000).then(() => false), // real-timer: how long a real child gets to stop before it is killed | |
| 114 | 114 | ]); |
| 115 | 115 | if (!gone) child.kill("SIGKILL"); |
| 116 | 116 | await child.exited; |
| @@ -144,7 +144,7 @@ describe("main.ts with the variables production sets", () => { | ||
| 144 | 144 | }); |
| 145 | 145 | |
| 146 | 146 | for (const name of ["inline", "unset", "worker"]) |
| 147 | test(`FORGE_ENGINE ${name}: alive ten seconds on, still answering, and nothing uncaught in its log`, () => { | |
| 147 | test(`FORGE_ENGINE ${name}: alive eight seconds on, still answering, and nothing uncaught in its log`, () => { | |
| 148 | 148 | const b = of(name); |
| 149 | 149 | expect(b.alive, `exited with ${b.exitCode}:\n${tail(b)}`).toBe(true); |
| 150 | 150 | expect(b.health, tail(b)).toBe(200); |
new above
offline