




















@@ -245,16 +245,16 @@ describe("maybeRepairGatewayDaemon", () => {
245245});
246246}
247247248-async function runAutoRepair() {
248+async function runAutoRepair(options: { repair?: boolean; yes?: boolean } = { repair: true }) {
249249const runtime = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
250250await maybeRepairGatewayDaemon({
251251cfg: { gateway: {} },
252252 runtime,
253253prompter: createDoctorPrompter({
254254 runtime,
255-options: { repair: true },
255+ options,
256256}),
257-options: { deep: false, repair: true },
257+options: { deep: false, ...options },
258258gatewayDetailsMessage: "details",
259259healthOk: false,
260260});
@@ -542,6 +542,39 @@ describe("maybeRepairGatewayDaemon", () => {
542542expect(service.restart).not.toHaveBeenCalled();
543543});
544544545+it("skips running service restart during non-interactive repairs", async () => {
546+setPlatform("linux");
547+548+await runNonInteractiveRepair();
549+550+expect(service.restart).not.toHaveBeenCalled();
551+});
552+553+it("starts stopped service during non-interactive repairs", async () => {
554+setPlatform("linux");
555+service.readRuntime.mockResolvedValue({ status: "stopped" });
556+557+await runNonInteractiveRepair();
558+559+expect(service.restart).toHaveBeenCalledTimes(1);
560+});
561+562+it("restarts running service when repair is explicitly approved", async () => {
563+setPlatform("linux");
564+565+await runAutoRepair();
566+567+expect(service.restart).toHaveBeenCalledTimes(1);
568+});
569+570+it("restarts running service when --yes explicitly approves repairs", async () => {
571+setPlatform("linux");
572+573+await runAutoRepair({ yes: true });
574+575+expect(service.restart).toHaveBeenCalledTimes(1);
576+});
577+545578it("skips gateway service install when service repair policy is external", async () => {
546579setPlatform("linux");
547580service.isLoaded.mockResolvedValue(false);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。