gateway: harden shared auth resolution across systemd, discord, and node host
This commit is contained in:
@@ -66,6 +66,8 @@ describe("runServiceRestart token drift", () => {
|
||||
vi.unstubAllEnvs();
|
||||
vi.stubEnv("OPENCLAW_GATEWAY_TOKEN", "");
|
||||
vi.stubEnv("CLAWDBOT_GATEWAY_TOKEN", "");
|
||||
vi.stubEnv("OPENCLAW_GATEWAY_URL", "");
|
||||
vi.stubEnv("CLAWDBOT_GATEWAY_URL", "");
|
||||
});
|
||||
|
||||
it("emits drift warning when enabled", async () => {
|
||||
@@ -80,7 +82,9 @@ describe("runServiceRestart token drift", () => {
|
||||
expect(loadConfig).toHaveBeenCalledTimes(1);
|
||||
const jsonLine = runtimeLogs.find((line) => line.trim().startsWith("{"));
|
||||
const payload = JSON.parse(jsonLine ?? "{}") as { warnings?: string[] };
|
||||
expect(payload.warnings?.[0]).toContain("gateway install --force");
|
||||
expect(payload.warnings).toEqual(
|
||||
expect.arrayContaining([expect.stringContaining("gateway install --force")]),
|
||||
);
|
||||
});
|
||||
|
||||
it("uses gateway.auth.token when checking drift", async () => {
|
||||
@@ -106,7 +110,9 @@ describe("runServiceRestart token drift", () => {
|
||||
|
||||
const jsonLine = runtimeLogs.find((line) => line.trim().startsWith("{"));
|
||||
const payload = JSON.parse(jsonLine ?? "{}") as { warnings?: string[] };
|
||||
expect(payload.warnings?.[0]).toContain("gateway install --force");
|
||||
expect(payload.warnings).toEqual(
|
||||
expect.arrayContaining([expect.stringContaining("gateway install --force")]),
|
||||
);
|
||||
});
|
||||
|
||||
it("skips drift warning when disabled", async () => {
|
||||
|
||||
Reference in New Issue
Block a user