fix: restart repeat provisions and record live controller

This commit is contained in:
冰朔 2026-08-05 11:43:06 +08:00
commit e99135dbb5
4 changed files with 66 additions and 4 deletions

View file

@ -100,6 +100,16 @@ test("provision copies only declared files and verifies loopback health", async
assert.match(fs.readFileSync(path.join(unitDir, "example.service"), "utf8"), new RegExp(commit));
assert.equal(commands.some(([, args]) => args.includes("enable") && args.includes("--now")), true);
assert.equal(healthChecks, 2);
commands.length = 0;
const repeat = await provision({ target: "JD-FD-PRIMARY", action: "provision-approved-architecture", resource: `${requestId}@${commit}` }, {
repoDir, releasesDir, unitDir, receiptsDir,
run: async (file, args) => { commands.push([file, args]); return { stdout: args.includes("rev-parse") ? `${commit}\n` : "" }; },
getJson: async () => ({ ok: true, mode: "read-only" }),
healthDelayMs: 0,
});
assert.equal(repeat.ok, true);
assert.equal(commands.some(([, args]) => args[0] === "restart" && args[1] === "example.service"), true);
assert.equal(commands.some(([, args]) => args.includes("enable") && args.includes("--now")), false);
} finally { fs.rmSync(root, { recursive: true, force: true }); }
});