mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 13:30:42 +00:00
test(update): cover authenticated restart updates
This commit is contained in:
@@ -414,6 +414,10 @@ describe("inspectGatewayRestart", () => {
|
||||
server: { version: "2026.4.24", connId: "new" },
|
||||
});
|
||||
const service = makeGatewayService({ status: "running", pid: 8000 });
|
||||
const serviceEnv = {
|
||||
...process.env,
|
||||
OPENCLAW_STATE_DIR: "/tmp/openclaw-restart-service-state",
|
||||
} as NodeJS.ProcessEnv;
|
||||
inspectPortUsage.mockResolvedValue({
|
||||
port: 18789,
|
||||
status: "busy",
|
||||
@@ -427,6 +431,7 @@ describe("inspectGatewayRestart", () => {
|
||||
port: 18789,
|
||||
expectedVersion: "2026.4.24",
|
||||
attempts: 1,
|
||||
env: serviceEnv,
|
||||
});
|
||||
|
||||
expect(snapshot).toMatchObject({
|
||||
@@ -443,6 +448,7 @@ describe("inspectGatewayRestart", () => {
|
||||
expect(probeGateway).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
auth: { token: "probe-token", password: undefined },
|
||||
env: serviceEnv,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -237,6 +237,7 @@ async function confirmGatewayReachable(params: {
|
||||
port: number;
|
||||
includeHealthDetails?: boolean;
|
||||
auth?: GatewayRestartProbeAuth;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}): Promise<GatewayReachability> {
|
||||
const token = normalizeOptionalString(params.auth?.token ?? process.env.OPENCLAW_GATEWAY_TOKEN);
|
||||
const password = normalizeOptionalString(
|
||||
@@ -247,6 +248,7 @@ async function confirmGatewayReachable(params: {
|
||||
auth: token || password ? { token, password } : undefined,
|
||||
timeoutMs: 3_000,
|
||||
includeDetails: params.includeHealthDetails === true,
|
||||
env: params.env,
|
||||
});
|
||||
const reachedGateway =
|
||||
probe.ok ||
|
||||
@@ -307,6 +309,7 @@ async function inspectGatewayPortHealth(params: {
|
||||
await confirmGatewayReachable({
|
||||
port: params.port,
|
||||
auth: params.auth,
|
||||
env: process.env,
|
||||
})
|
||||
).reachable;
|
||||
} catch {
|
||||
@@ -336,6 +339,7 @@ export async function inspectGatewayRestart(params: {
|
||||
port: params.port,
|
||||
includeHealthDetails: Boolean(expectedVersion),
|
||||
auth: params.probeAuth,
|
||||
env,
|
||||
});
|
||||
activatedPluginErrors = reachability.activatedPluginErrors;
|
||||
channelProbeErrors = reachability.channelProbeErrors;
|
||||
|
||||
Reference in New Issue
Block a user