Skip to content
4 changes: 2 additions & 2 deletions tests/boundary/process/packagedWasmVerifierOwnership.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const expectHarnessFailureCleanup = async (
.map((line) => JSON.parse(line));
const ready = events.find(({ kind }) => kind === "ready");
expect(ready).toBeDefined();
expect(ready.runId).toMatch(/^rea-package-command-/);
expect(ready.runId).toMatch(/^rea-verifier-command-/);
expect(ready.descendantRunId).toBe(ready.runId);
expectRootCleanupAfterProcessExit(events, ready.runtime, [
ready.leader,
Expand Down Expand Up @@ -316,7 +316,7 @@ it.skipIf(process.platform === "win32").each([
const observed = JSON.parse(await readFile(report, "utf8"));
expect(observed.reason).toBe("timeout");
expect(observed.pids).toHaveLength(2);
expect(observed.runId).toMatch(/^rea-package-command-/);
expect(observed.runId).toMatch(/^rea-verifier-command-/);
expect(observed.descendantRunId).toBe(observed.runId);
expect(observed.rootExists).toBe(denied);
expect(observed.livePids.sort()).toEqual(
Expand Down
28 changes: 22 additions & 6 deletions tests/boundary/process/packedBridgeVerification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ try {
await verifyPackedBridge({ ...JSON.parse(process.env.REA_PACKED_VERIFY_INPUT), commands });
console.log(JSON.stringify({ accepted: true }));
} catch (error) {
console.log(JSON.stringify({ accepted: false, stderr: String(error.stderr) }));
if (error?.name !== "VerifierCommandExitError") throw error;
console.log(JSON.stringify({ accepted: false, stderr: error.snapshot.stderr.text }));
}
}, [() => commands === undefined ? root.close() : commands.close()]);`,
],
Expand Down Expand Up @@ -164,15 +165,21 @@ it.each(packedFiles)(
it("rejects a missing actual Python member even when the listing advertises it", async () => {
const input = await fixture(validSource, true);
await expect(verifyPackedBridge(input)).rejects.toMatchObject({
stderr: expect.stringContaining(hopper),
name: "VerifierCommandExitError",
snapshot: { stderr: { text: expect.stringContaining(hopper) } },
});
expect(await readdir(input.workspace)).toEqual([]);
});

it("reports invalid packed Python syntax with the member filename", async () => {
const input = await fixture("def broken(:\n");
await expect(verifyPackedBridge(input)).rejects.toMatchObject({
stderr: expect.stringMatching(/hopper_bridge\.py[\s\S]*SyntaxError/u),
name: "VerifierCommandExitError",
snapshot: {
stderr: {
text: expect.stringMatching(/hopper_bridge\.py[\s\S]*SyntaxError/u),
},
},
});
expect(await readdir(input.workspace)).toEqual([]);
});
Expand All @@ -198,7 +205,10 @@ it.each(["valid", "invalid"] as const)(
if (kind === "valid") await parsed;
else
await expect(parsed).rejects.toMatchObject({
stderr: expect.stringContaining("SyntaxError"),
name: "VerifierCommandExitError",
snapshot: {
stderr: { text: expect.stringContaining("SyntaxError") },
},
});
expect(await readdir(root.path)).toEqual(["pack"]);
expect(await readFile(tarball)).toEqual(await readFile(input.tarball));
Expand Down Expand Up @@ -231,7 +241,12 @@ it.each(["symlink", "hardlink", "directory"])(
kind,
]);
await expect(verifyPackedBridge(input)).rejects.toMatchObject({
stderr: expect.stringContaining(`${hopper} is not a regular file`),
name: "VerifierCommandExitError",
snapshot: {
stderr: {
text: expect.stringContaining(`${hopper} is not a regular file`),
},
},
});
expect(await readdir(input.workspace)).toEqual([]);
},
Expand All @@ -241,7 +256,8 @@ it("rejects malformed archives without writing to the caller's workspace", async
const input = await fixture();
await writeFile(input.tarball, "not a tar archive\n");
await expect(verifyPackedBridge(input)).rejects.toMatchObject({
stderr: expect.stringContaining("ReadError"),
name: "VerifierCommandExitError",
snapshot: { stderr: { text: expect.stringContaining("ReadError") } },
});
expect(await readdir(input.workspace)).toEqual([]);
});