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

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:19547qkh3k is past its budget: trevato/forge: "a walk that blows up half-way (outside any step) still removes its forge" failed on 3 pulls in the last… #12458

Merged opened this

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

Merged

torque/forge:torque/12457-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 2 commits fork

  • Merged. torque/12457-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as 279bc97.

Review

Sign in to review this change.
1 file changed +17 −0
test/release-journey.test.ts +17
@@ -30,9 +30,15 @@ let dir = "";
3030 let parent: App;
3131 let parentServers: Servers;
3232 let adminToken = "";
33 const stopped = new Set<unknown>();
3334 const kids = new Map<string, { app: App; servers: Servers; crew: CrewHandle; dataDir: string }>();
3435 /** A step that answers 503, as `METHOD path` on the child. */
3536 let broken: string | undefined;
37 /**
38 * When set, a child's stand-in process is stopped just before the parent is asked to remove it:
39 * a real removal ends the process first, and a live stand-in would write its files back.
40 */
41 let stopBeforeRemove = false;
3642
3743 beforeAll(async () => {
3844 dir = await mkdtemp(join(tmpdir(), "forge-journey-"));
@@ -50,6 +56,7 @@ beforeAll(async () => {
5056
5157 afterAll(async () => {
5258 for (const k of kids.values()) {
59 if (stopped.has(k)) continue;
5360 await k.crew.stop();
5461 k.servers.stop();
5562 k.app.close();
@@ -93,6 +100,14 @@ function routed(log: string[]): typeof fetch {
93100 const url = new URL(input instanceof Request ? input.url : String(input));
94101 const name = /^([a-z0-9-]+)--forge\.test$/.exec(url.hostname)?.[1];
95102 if (name === undefined) {
103 const gone = stopBeforeRemove && init?.method === "POST" ? /^\/forges\/([a-z0-9-]+)\/remove$/.exec(url.pathname)?.[1] : undefined;
104 const live = gone === undefined ? undefined : kids.get(gone);
105 if (live !== undefined && !stopped.has(live)) {
106 stopped.add(live);
107 await live.crew.stop();
108 live.servers.stop();
109 live.app.close();
110 }
96111 // The parent believes it lives at forge.test: a browser there would send that origin.
97112 const headers = new Headers(init?.headers);
98113 if (headers.has("origin")) headers.set("origin", "https://forge.test");
@@ -167,6 +182,7 @@ test("an address that is not http(s) is refused before anything is sent", async
167182 });
168183
169184 test("a walk that blows up half-way (outside any step) still removes its forge", async () => {
185 stopBeforeRemove = true;
170186 let calls = 0;
171187 const log: string[] = [];
172188 const inner = routed(log);
@@ -176,6 +192,7 @@ test("a walk that blows up half-way (outside any step) still removes its forge",
176192 return (calls += 1);
177193 };
178194 const result = await walkJourney({ base: parentServers.url, fetch: inner, adminToken, now, sleep: () => Bun.sleep(100), pollMs: 100 }); // real-timer: the stand-in crew child runs in real time
195 stopBeforeRemove = false;
179196 // The walk does not reject: it says what stopped it, and cleans up all the same.
180197 expect(result.ok).toBe(false);
181198 expect(result.failure).toBe("the walk stopped unexpectedly");

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs