mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:21:23 +00:00
fix(update): honor update.channel for update.run
This commit is contained in:
@@ -16,6 +16,8 @@ vi.mock("../infra/update-runner.js", () => ({
|
||||
})),
|
||||
}));
|
||||
|
||||
import { writeConfigFile } from "../config/config.js";
|
||||
import { runGatewayUpdate } from "../infra/update-runner.js";
|
||||
import { sleep } from "../utils.js";
|
||||
import {
|
||||
connectOk,
|
||||
@@ -193,6 +195,37 @@ describe("gateway update.run", () => {
|
||||
process.off("SIGUSR1", sigusr1);
|
||||
}
|
||||
});
|
||||
|
||||
test("uses configured update channel", async () => {
|
||||
const sigusr1 = vi.fn();
|
||||
process.on("SIGUSR1", sigusr1);
|
||||
|
||||
try {
|
||||
await writeConfigFile({ update: { channel: "beta" } });
|
||||
const updateMock = vi.mocked(runGatewayUpdate);
|
||||
updateMock.mockClear();
|
||||
|
||||
const id = "req-update-channel";
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
type: "req",
|
||||
id,
|
||||
method: "update.run",
|
||||
params: {
|
||||
restartDelayMs: 0,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const res = await onceMessage<{ ok: boolean; payload?: unknown }>(
|
||||
ws,
|
||||
(o) => o.type === "res" && o.id === id,
|
||||
);
|
||||
expect(res.ok).toBe(true);
|
||||
expect(updateMock.mock.calls[0]?.[0]?.channel).toBe("beta");
|
||||
} finally {
|
||||
process.off("SIGUSR1", sigusr1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("gateway node command allowlist", () => {
|
||||
|
||||
Reference in New Issue
Block a user