Skip to content

Commit 3848b96

Browse files
committed
test: centralize mcp gateway env cleanup
1 parent 365279b commit 3848b96

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/mcp-code-mode-gateway-e2e.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { stageQaMockAuthProfiles } from "../extensions/qa-lab/src/providers/shar
1111
import { buildQaGatewayConfig } from "../extensions/qa-lab/src/qa-gateway-config.js";
1212
import { resetConfigRuntimeState } from "../src/config/config.js";
1313
import { startGatewayServer } from "../src/gateway/server.js";
14+
import { deleteTestEnvValue, setTestEnvValue } from "../src/test-utils/env.js";
1415
import { writeProbeMcpServer } from "./e2e/lib/mcp-code-mode-probe-server.ts";
1516
import {
1617
type McpCodeModeMentions,
@@ -87,9 +88,9 @@ async function readSessionLogMentions(stateDir: string): Promise<Record<string,
8788

8889
function restoreEnvValue(key: string, value: string | undefined): void {
8990
if (value === undefined) {
90-
delete process.env[key];
91+
deleteTestEnvValue(key);
9192
} else {
92-
process.env[key] = value;
93+
setTestEnvValue(key, value);
9394
}
9495
}
9596

@@ -203,9 +204,9 @@ export async function main() {
203204
serverPath,
204205
});
205206

206-
process.env.OPENCLAW_STATE_DIR = stateDir;
207-
process.env.OPENCLAW_CONFIG_PATH = configPath;
208-
process.env.OPENCLAW_TEST_FAST = "1";
207+
setTestEnvValue("OPENCLAW_STATE_DIR", stateDir);
208+
setTestEnvValue("OPENCLAW_CONFIG_PATH", configPath);
209+
setTestEnvValue("OPENCLAW_TEST_FAST", "1");
209210
resetConfigRuntimeState();
210211

211212
server = await startGatewayServer(gatewayPort, {

0 commit comments

Comments
 (0)