test(hopper): fix fixture context and cleanup assumptions
This commit is contained in:
@@ -306,7 +306,7 @@ test.for(["handoff", "not-found"] as const)(
|
|||||||
const token = setting("REA_TOKEN");
|
const token = setting("REA_TOKEN");
|
||||||
const runId = setting("REA_RUN_ID");
|
const runId = setting("REA_RUN_ID");
|
||||||
runtime = dirname(socket);
|
runtime = dirname(socket);
|
||||||
const lateBridge = async (identity: string, credential = token) => {
|
const lateBridge = (identity: string, credential = token) => {
|
||||||
const child = spawn(
|
const child = spawn(
|
||||||
process.execPath,
|
process.execPath,
|
||||||
[
|
[
|
||||||
@@ -318,14 +318,14 @@ test.for(["handoff", "not-found"] as const)(
|
|||||||
{ stdio: "ignore" },
|
{ stdio: "ignore" },
|
||||||
);
|
);
|
||||||
children.push(child);
|
children.push(child);
|
||||||
await vi.waitFor(() => access(socket));
|
|
||||||
return child;
|
return child;
|
||||||
};
|
};
|
||||||
for (const [identity, credential] of [
|
for (const [identity, credential] of [
|
||||||
["different-run", token],
|
["different-run", token],
|
||||||
[runId, "different-token"],
|
[runId, "different-token"],
|
||||||
] as const) {
|
] as const) {
|
||||||
const wrong = await lateBridge(identity, credential);
|
const wrong = lateBridge(identity, credential);
|
||||||
|
await vi.waitFor(() => access(socket));
|
||||||
expect(parseMcpToolError(await call("close_binary")).error.code).toBe(
|
expect(parseMcpToolError(await call("close_binary")).error.code).toBe(
|
||||||
"cleanup_incomplete",
|
"cleanup_incomplete",
|
||||||
);
|
);
|
||||||
@@ -336,7 +336,9 @@ test.for(["handoff", "not-found"] as const)(
|
|||||||
}
|
}
|
||||||
const closing = call("close_binary");
|
const closing = call("close_binary");
|
||||||
await delay(150);
|
await delay(150);
|
||||||
const owned = await lateBridge(runId);
|
// A verified close may remove the socket before the fixture can poll it.
|
||||||
|
// The successful close and child exit establish the owned bridge outcome.
|
||||||
|
const owned = lateBridge(runId);
|
||||||
expect((await closing).isError).not.toBe(true);
|
expect((await closing).isError).not.toBe(true);
|
||||||
await vi.waitFor(() => expect(owned.exitCode).toBe(0));
|
await vi.waitFor(() => expect(owned.exitCode).toBe(0));
|
||||||
await expect(access(runtime)).rejects.toMatchObject({ code: "ENOENT" });
|
await expect(access(runtime)).rejects.toMatchObject({ code: "ENOENT" });
|
||||||
|
|||||||
Reference in New Issue
Block a user