mvp-ai's picture
download
raw
1.81 kB
// Copyright (c) 2026 the Zuke contributors
// SPDX-License-Identifier: MIT
/**
* End-to-end: a `killAfter` timeout must reap a child that ignores `SIGTERM`.
* The {@link file://./fixtures/kill_after_build.ts} fixture runs, in a real
* process, a real child that swallows `SIGTERM` and sleeps for a minute. Only a
* `SIGTERM` → grace → `SIGKILL` escalation ends that, so the build has to fail
* with a timeout in seconds rather than hang for the child's full sleep. Signal
* delivery to a live OS process is exactly what an in-process test cannot prove.
* Excluded from the fast unit gate; run by the `integration` target on the OS
* matrix.
*/
import { assertEquals } from "../../packages/core/tests/_assert.ts";
import { runFixture } from "./_harness.ts";
const FIXTURE = new URL("./fixtures/kill_after_build.ts", import.meta.url);
/** The child sleeps 60s; anything under this bound proves it was killed. */
const MAX_MS = 30_000;
Deno.test("a killAfter timeout escalates to SIGKILL and does not hang", async () => {
const started = performance.now();
const { code, out, err } = await runFixture(FIXTURE, ["timeout"], {});
const elapsed = performance.now() - started;
const output = out + err;
// The child really started (so the timeout raced a live process)…
assertEquals(
output.includes("CHILD_UP"),
true,
`child never started:\n${output}`,
);
// …the build failed with the timeout, not with something else…
assertEquals(code, 1, `expected a failing build, got ${code}:\n${output}`);
assertEquals(
output.includes("timed out after 200ms"),
true,
`expected a CommandTimeoutError:\n${output}`,
);
// …and it did not wait out the child's own sleep.
assertEquals(elapsed < MAX_MS, true, `took ${Math.round(elapsed)}ms`);
});

Xet Storage Details

Size:
1.81 kB
·
Xet hash:
d8ee4b03640ba895d70f9f1cf75acaab8f9266a878397b60e094f75acc4af298

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.