test: route CLI backend fixture env setup

This commit is contained in:
Shakker
2026-06-24 19:32:12 +01:00
parent 3fbdbb5440
commit 8ecbf83c67
+4 -3
View File
@@ -10,6 +10,7 @@ import { shouldSkipLiveProviderDrift } from "../agents/live-test-provider-drift.
import { parseModelRef } from "../agents/model-selection.js";
import { clearRuntimeConfigSnapshot, type OpenClawConfig } from "../config/config.js";
import { isTruthyEnvValue } from "../infra/env.js";
import { setTestEnvValue } from "../test-utils/env.js";
import {
applyCliBackendLiveEnv,
createBootstrapWorkspace,
@@ -285,7 +286,7 @@ describeLive("gateway live (cli backend)", () => {
applyCliBackendLiveEnv(preservedEnv);
const token = `test-${randomUUID()}`;
process.env.OPENCLAW_GATEWAY_TOKEN = token;
setTestEnvValue("OPENCLAW_GATEWAY_TOKEN", token);
const port = await getFreeGatewayPort();
logCliBackendLiveStep("env-ready", { port });
@@ -369,7 +370,7 @@ describeLive("gateway live (cli backend)", () => {
? await createMcpSchemaProbePlugin(tempDir)
: undefined;
const useMinimalToolsProfile = providerId === "codex-cli" && !schemaProbePluginPath;
process.env.OPENCLAW_STATE_DIR = stateDir;
setTestEnvValue("OPENCLAW_STATE_DIR", stateDir);
const bundleMcp = backendResolved?.bundleMcp === true;
const bootstrapWorkspace = await createBootstrapWorkspace(tempDir);
const disableMcpConfig = process.env.OPENCLAW_LIVE_CLI_BACKEND_DISABLE_MCP_CONFIG !== "0";
@@ -473,7 +474,7 @@ describeLive("gateway live (cli backend)", () => {
};
const tempConfigPath = path.join(tempDir, "openclaw.json");
await fs.writeFile(tempConfigPath, `${JSON.stringify(nextCfg, null, 2)}\n`);
process.env.OPENCLAW_CONFIG_PATH = tempConfigPath;
setTestEnvValue("OPENCLAW_CONFIG_PATH", tempConfigPath);
const deviceIdentity = await ensurePairedTestGatewayClientIdentity();
let server: Awaited<ReturnType<typeof startGatewayServer>> | undefined;
let client: Awaited<ReturnType<typeof connectTestGatewayClient>> | undefined;