mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-15 14:50:48 +00:00
fix(update): verify daemon restart port
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
} from "../../daemon/gateway-entrypoint.js";
|
||||
import {
|
||||
shouldPrepareUpdatedInstallRestart,
|
||||
resolveUpdatedGatewayRestartPort,
|
||||
shouldUseLegacyProcessRestartAfterUpdate,
|
||||
} from "./update-command.js";
|
||||
|
||||
@@ -83,6 +84,28 @@ describe("shouldPrepareUpdatedInstallRestart", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveUpdatedGatewayRestartPort", () => {
|
||||
it("uses the managed service port ahead of the caller environment", () => {
|
||||
expect(
|
||||
resolveUpdatedGatewayRestartPort({
|
||||
config: { gateway: { port: 19000 } } as never,
|
||||
processEnv: { OPENCLAW_GATEWAY_PORT: "19001" },
|
||||
serviceEnv: { OPENCLAW_GATEWAY_PORT: "19002" },
|
||||
}),
|
||||
).toBe(19002);
|
||||
});
|
||||
|
||||
it("falls back to the post-update config when no service port is available", () => {
|
||||
expect(
|
||||
resolveUpdatedGatewayRestartPort({
|
||||
config: { gateway: { port: 19000 } } as never,
|
||||
processEnv: {},
|
||||
serviceEnv: {},
|
||||
}),
|
||||
).toBe(19000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldUseLegacyProcessRestartAfterUpdate", () => {
|
||||
it("never restarts package updates through the pre-update process", () => {
|
||||
expect(shouldUseLegacyProcessRestartAfterUpdate({ updateMode: "npm" })).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user