test: cover concurrent registry and close cleanup

This commit is contained in:
2026-08-05 17:02:01 +02:00
parent 7efaec434f
commit f36d5aefa8
2 changed files with 30 additions and 8 deletions
+19
View File
@@ -189,6 +189,25 @@ test("Pi receives the leased workspace runtime config and releases it on direct
expect(release).toHaveBeenCalledOnce();
});
test("a close-only child event releases its temporary Pi agent snapshot", () => {
const child = recordingChild();
let snapshotDir: string | undefined;
const mgr = new PiProcessManager(loadConfig({}), {
spawnFn: (_command, _args, options) => {
snapshotDir = options.env.PI_CODING_AGENT_DIR;
return child as any;
},
});
mgr.createFor("close-only-snapshot", {});
expect(snapshotDir).toBeTruthy();
expect(existsSync(snapshotDir!)).toBe(true);
child.emit("close", 0);
expect(existsSync(snapshotDir!)).toBe(false);
mgr.teardown("close-only-snapshot");
});
test.each([
["new", "auth.json", '{"deepseek":{"key":"!runtime-auth-command runtime-secret /private/runtime-auth"}}\n'],
["new", "models.json", '{"providers":{"local-qwen":{"headers":["!runtime-model-command runtime-secret /private/runtime-model"]}}}\n'],