






















@@ -2912,6 +2912,40 @@ describe("update-cli", () => {
29122912expect(logs.join("\n")).not.toContain("Gateway: restarted and verified.");
29132913});
291429142915+it("fails managed git restart when the stopped service cannot be restarted", async () => {
2916+const serviceEntrypoint = path.join(process.cwd(), "dist", "index.js");
2917+serviceReadCommand.mockResolvedValue({
2918+programArguments: ["node", serviceEntrypoint, "gateway", "run"],
2919+environment: {
2920+OPENCLAW_SERVICE_MARKER: "openclaw",
2921+OPENCLAW_SERVICE_KIND: "gateway",
2922+},
2923+});
2924+serviceLoaded.mockResolvedValue(false);
2925+serviceLoaded.mockResolvedValueOnce(true);
2926+serviceReadRuntime.mockResolvedValue({
2927+status: "stopped",
2928+pid: null,
2929+state: "stopped",
2930+});
2931+serviceReadRuntime.mockResolvedValueOnce({
2932+status: "running",
2933+pid: 4242,
2934+state: "running",
2935+});
2936+runRestartScript.mockRejectedValueOnce(new Error("restart unavailable"));
2937+mockGitUpdateAfterMutation();
2938+2939+await updateCommand({ yes: true });
2940+2941+const logs = vi.mocked(defaultRuntime.log).mock.calls.map((call) => String(call[0]));
2942+expect(serviceStop).toHaveBeenCalledTimes(1);
2943+expect(runRestartScript).toHaveBeenCalledTimes(1);
2944+expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
2945+expect(logs.join("\n")).toContain("Gateway: restart failed: Error: restart unavailable");
2946+expect(logs.join("\n")).not.toContain("Gateway: restarted and verified.");
2947+});
2948+29152949it("stops a managed gateway rooted at the git checkout when switching package installs to dev", async () => {
29162950const packageRoot = createCaseDir("openclaw-update-package-root");
29172951const gitRoot = await createTrackedTempDir("openclaw-update-git-service-root-");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。