fix: restart gateway after update by default

This commit is contained in:
Peter Steinberger
2026-01-23 11:49:59 +00:00
parent 8b7b7e154f
commit 2c85b1b409
5 changed files with 37 additions and 12 deletions

View File

@@ -415,7 +415,7 @@ describe("update-cli", () => {
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
});
it("updateCommand restarts daemon when --restart is set", async () => {
it("updateCommand restarts daemon by default", async () => {
const { runGatewayUpdate } = await import("../infra/update-runner.js");
const { runDaemonRestart } = await import("./daemon-cli.js");
const { updateCommand } = await import("./update-cli.js");
@@ -430,11 +430,30 @@ describe("update-cli", () => {
vi.mocked(runGatewayUpdate).mockResolvedValue(mockResult);
vi.mocked(runDaemonRestart).mockResolvedValue(true);
await updateCommand({ restart: true });
await updateCommand({});
expect(runDaemonRestart).toHaveBeenCalled();
});
it("updateCommand skips restart when --no-restart is set", async () => {
const { runGatewayUpdate } = await import("../infra/update-runner.js");
const { runDaemonRestart } = await import("./daemon-cli.js");
const { updateCommand } = await import("./update-cli.js");
const mockResult: UpdateRunResult = {
status: "ok",
mode: "git",
steps: [],
durationMs: 100,
};
vi.mocked(runGatewayUpdate).mockResolvedValue(mockResult);
await updateCommand({ restart: false });
expect(runDaemonRestart).not.toHaveBeenCalled();
});
it("updateCommand skips success message when restart does not run", async () => {
const { runGatewayUpdate } = await import("../infra/update-runner.js");
const { runDaemonRestart } = await import("./daemon-cli.js");