From d4375d458f8b3db8c0e5c08eee200e2611298981 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 24 Oct 2026 20:54:48 +0200 Subject: [PATCH] Tests: say why a job ended before its export; minted seeds differ Co-Authored-By: Claude Opus 5.5 --- scripts/test-vili-daemon.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/test-vili-daemon.mjs b/scripts/test-vili-daemon.mjs index 063a806..32e73fe 100644 --- a/scripts/test-vili-daemon.mjs +++ b/scripts/test-vili-daemon.mjs @@ -1500,7 +1500,9 @@ test("losing the lease kills a running export within a second and records nothin await until(() => daemon.starts().length === 1, "the version probe, run once the lease was held"); assert.equal(existsSync(path.join(daemon.stateRoot, "logs")), false, "the probe writes nothing to the state root"); const pending = generate(daemon, exportRequest({ clipName: "slow" })); - const run = await until(() => exportStarts(daemon)[0], "the export to start"); + const ended = pending.then((answer) => { throw new Error(`the job ended before its export started: ${answer.status} ${answer.raw.slice(0, 300)}`); }); + ended.catch(() => {}); + const run = await Promise.race([until(() => exportStarts(daemon)[0], "the export to start"), ended]); rmSync(daemon.lease); const lost = Date.now(); await until(() => !isAlive(run.pid), "the export to be dead", 2); @@ -1529,6 +1531,9 @@ test("the seed is minted when absent and recorded for every job", async () => { assert.equal(given.worker.seed, 7); assert.equal(given.worker.metaSeed, 7); assert.equal(JSON.parse(readFileSync(path.join(given.artifactDir, "meta.json"), "utf8")).seed, 7); + const minted = new Set(); + for (let count = 0; count < 3; count += 1) minted.add((await generate(daemon, exportRequest())).body.seed); + assert.ok(minted.size > 1, "minted seeds differ from job to job"); const zero = (await generate(daemon, exportRequest({ seed: 0 }))).body; assert.equal(zero.seed, 0, "0 is a seed"); } finally {