test(daemon): cover self-only stale pid restart failure
This commit is contained in:
parent
fe36d98bc3
commit
37828cd4bb
@ -230,6 +230,26 @@ describe("runDaemonRestart health checks", () => {
|
||||
expect(waitForGatewayHealthyRestart).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("fails without killing the current runtime pid when stale detection only includes self", async () => {
|
||||
const unhealthy: RestartHealthSnapshot = {
|
||||
healthy: false,
|
||||
staleGatewayPids: [1993],
|
||||
runtime: { status: "running", pid: 1993 },
|
||||
portUsage: { port: 18789, status: "busy", listeners: [], hints: [] },
|
||||
};
|
||||
waitForGatewayHealthyRestart.mockResolvedValue(unhealthy);
|
||||
|
||||
await expect(runDaemonRestart({ json: true })).rejects.toMatchObject({
|
||||
message: "Gateway restart timed out after 60s waiting for health checks.",
|
||||
hints: ["openclaw gateway status --deep", "openclaw doctor"],
|
||||
});
|
||||
|
||||
expect(terminateStaleGatewayPids).not.toHaveBeenCalled();
|
||||
expect(service.restart).not.toHaveBeenCalled();
|
||||
expect(waitForGatewayHealthyRestart).toHaveBeenCalledTimes(1);
|
||||
expect(renderRestartDiagnostics).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("skips stale-pid retry health checks when the retry restart is only scheduled", async () => {
|
||||
const unhealthy: RestartHealthSnapshot = {
|
||||
healthy: false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user