mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:20:42 +00:00
fix: fail updates on activated plugin load errors
This commit is contained in:
@@ -1645,6 +1645,60 @@ describe("update-cli", () => {
|
||||
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
||||
it("fails a package update when the restarted gateway reports activated plugin load errors", async () => {
|
||||
setupUpdatedRootRefresh({
|
||||
gatewayUpdateImpl: async () =>
|
||||
makeOkUpdateResult({
|
||||
mode: "npm",
|
||||
root: createCaseDir("openclaw-updated-root"),
|
||||
before: { version: "2026.4.23" },
|
||||
after: { version: "2026.4.24" },
|
||||
}),
|
||||
});
|
||||
readPackageVersion.mockResolvedValue("2026.4.24");
|
||||
serviceLoaded.mockResolvedValue(true);
|
||||
probeGateway.mockResolvedValue({
|
||||
ok: true,
|
||||
close: null,
|
||||
server: {
|
||||
version: "2026.4.24",
|
||||
connId: "updated-gateway",
|
||||
},
|
||||
auth: { role: "operator", scopes: ["operator.read"], capability: "read_only" },
|
||||
health: {
|
||||
ok: true,
|
||||
plugins: {
|
||||
errors: [
|
||||
{
|
||||
id: "telegram",
|
||||
origin: "bundled",
|
||||
activated: true,
|
||||
error: "failed to install bundled runtime deps: ENOSPC",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
status: null,
|
||||
presence: null,
|
||||
configSnapshot: null,
|
||||
connectLatencyMs: 1,
|
||||
error: null,
|
||||
url: "ws://127.0.0.1:18789",
|
||||
});
|
||||
|
||||
await updateCommand({ yes: true });
|
||||
|
||||
expect(runRestartScript).toHaveBeenCalled();
|
||||
expect(probeGateway).toHaveBeenCalledWith(expect.objectContaining({ includeDetails: true }));
|
||||
expect(defaultRuntime.exit).toHaveBeenCalledWith(1);
|
||||
expect(
|
||||
vi
|
||||
.mocked(defaultRuntime.log)
|
||||
.mock.calls.map((call) => String(call[0]))
|
||||
.join("\n"),
|
||||
).toContain("- telegram: failed to install bundled runtime deps: ENOSPC");
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: "updateCommand refreshes service env from updated install root when available",
|
||||
|
||||
Reference in New Issue
Block a user