





























@@ -7,7 +7,7 @@ import type { StaleOpenClawUpdateLaunchdJob } from "../../daemon/launchd.js";
77import { createMockGatewayService } from "../../daemon/service.test-helpers.js";
88import type { PortConnections } from "../../infra/ports.js";
99import type { GatewayRestartHandoff } from "../../infra/restart-handoff.js";
10-import { captureEnv } from "../../test-utils/env.js";
10+import { captureEnv, deleteTestEnvValue, setTestEnvValue } from "../../test-utils/env.js";
1111import { VERSION } from "../../version.js";
1212import type { GatewayRestartSnapshot } from "./restart-health.js";
1313import { gatherDaemonStatus } from "./status.gather.js";
@@ -252,12 +252,12 @@ describe("gatherDaemonStatus", () => {
252252"DAEMON_GATEWAY_TOKEN",
253253"DAEMON_GATEWAY_PASSWORD",
254254]);
255-process.env.OPENCLAW_STATE_DIR = "/tmp/openclaw-cli";
256-process.env.OPENCLAW_CONFIG_PATH = "/tmp/openclaw-cli/openclaw.json";
257-delete process.env.OPENCLAW_GATEWAY_TOKEN;
258-delete process.env.OPENCLAW_GATEWAY_PASSWORD;
259-delete process.env.DAEMON_GATEWAY_TOKEN;
260-delete process.env.DAEMON_GATEWAY_PASSWORD;
255+setTestEnvValue("OPENCLAW_STATE_DIR", "/tmp/openclaw-cli");
256+setTestEnvValue("OPENCLAW_CONFIG_PATH", "/tmp/openclaw-cli/openclaw.json");
257+deleteTestEnvValue("OPENCLAW_GATEWAY_TOKEN");
258+deleteTestEnvValue("OPENCLAW_GATEWAY_PASSWORD");
259+deleteTestEnvValue("DAEMON_GATEWAY_TOKEN");
260+deleteTestEnvValue("DAEMON_GATEWAY_PASSWORD");
261261callGatewayStatusProbe.mockClear();
262262resolveGatewayProbeAuthSafeWithSecretInputsCalls.mockClear();
263263createConfigIOCalls.mockClear();
@@ -665,8 +665,8 @@ describe("gatherDaemonStatus", () => {
665665},
666666}),
667667);
668-process.env.OPENCLAW_STATE_DIR = tmp;
669-process.env.OPENCLAW_CONFIG_PATH = configPath;
668+setTestEnvValue("OPENCLAW_STATE_DIR", tmp);
669+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
670670serviceReadCommand.mockResolvedValueOnce({
671671programArguments: ["/bin/node", "cli", "gateway", "--port", "19001"],
672672environment: {
@@ -707,8 +707,8 @@ describe("gatherDaemonStatus", () => {
707707},
708708}),
709709);
710-process.env.OPENCLAW_STATE_DIR = tmp;
711-process.env.OPENCLAW_CONFIG_PATH = configPath;
710+setTestEnvValue("OPENCLAW_STATE_DIR", tmp);
711+setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
712712cliLoadedConfig = {
713713gateway: {
714714bind: "loopback",
@@ -756,7 +756,7 @@ describe("gatherDaemonStatus", () => {
756756},
757757},
758758};
759-process.env.DAEMON_GATEWAY_PASSWORD = "daemon-secretref-password"; // pragma: allowlist secret
759+setTestEnvValue("DAEMON_GATEWAY_PASSWORD", "daemon-secretref-password"); // pragma: allowlist secret
760760761761await gatherDaemonStatus({
762762rpc: {},
@@ -785,7 +785,7 @@ describe("gatherDaemonStatus", () => {
785785},
786786},
787787};
788-process.env.DAEMON_GATEWAY_TOKEN = "daemon-secretref-token";
788+setTestEnvValue("DAEMON_GATEWAY_TOKEN", "daemon-secretref-token");
789789790790await gatherDaemonStatus({
791791rpc: {},
@@ -1009,8 +1009,8 @@ describe("gatherDaemonStatus", () => {
10091009},
10101010},
10111011};
1012-process.env.OPENCLAW_GATEWAY_TOKEN = "env-token";
1013-process.env.OPENCLAW_GATEWAY_PASSWORD = "env-password"; // pragma: allowlist secret
1012+setTestEnvValue("OPENCLAW_GATEWAY_TOKEN", "env-token");
1013+setTestEnvValue("OPENCLAW_GATEWAY_PASSWORD", "env-password"); // pragma: allowlist secret
1014101410151015await gatherDaemonStatus({
10161016rpc: {},
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。