@@ -6,6 +6,7 @@ import path from "node:path";
|
6 | 6 | import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest"; |
7 | 7 | import { resolveDefaultAgentDir } from "../agents/agent-scope.js"; |
8 | 8 | import { AUTH_PROFILE_FILENAME } from "../agents/auth-profiles/constants.js"; |
| 9 | +import { deleteTestEnvValue } from "../test-utils/env.js"; |
9 | 10 | import { testing as controlPlaneRateLimitTesting } from "./control-plane-rate-limit.js"; |
10 | 11 | import { |
11 | 12 | connectOk, |
@@ -147,7 +148,7 @@ async function expectSchemaLookupInvalid(pathValue: unknown) {
|
147 | 148 | } |
148 | 149 | |
149 | 150 | async function writeUnresolvedAuthProfileTokenRef(missingEnvVar: string) { |
150 | | -delete process.env[missingEnvVar]; |
| 151 | +deleteTestEnvValue(missingEnvVar); |
151 | 152 | const authStorePath = path.join(resolveDefaultAgentDir({}), AUTH_PROFILE_FILENAME); |
152 | 153 | await fs.mkdir(path.dirname(authStorePath), { recursive: true }); |
153 | 154 | await fs.writeFile( |
@@ -177,7 +178,7 @@ beforeEach(() => {
|
177 | 178 | describe("gateway config methods", () => { |
178 | 179 | it("rejects config.set when SecretRef resolution fails", async () => { |
179 | 180 | const missingEnvVar = `OPENCLAW_MISSING_SECRETREF_${Date.now()}`; |
180 | | -delete process.env[missingEnvVar]; |
| 181 | +deleteTestEnvValue(missingEnvVar); |
181 | 182 | const current = await getCurrentConfigObject(); |
182 | 183 | const nextConfig = configWithGatewayTokenSecretRef(current.config, missingEnvVar); |
183 | 184 | |
@@ -805,7 +806,7 @@ describe("gateway config methods", () => {
|
805 | 806 | |
806 | 807 | it("rejects config.patch when merged SecretRefs cannot resolve", async () => { |
807 | 808 | const missingEnvVar = `OPENCLAW_MISSING_SECRETREF_PATCH_${Date.now()}`; |
808 | | -delete process.env[missingEnvVar]; |
| 809 | +deleteTestEnvValue(missingEnvVar); |
809 | 810 | const beforeHash = await getConfigHash(); |
810 | 811 | const res = await rpcReq<{ ok?: boolean; error?: { message?: string } }>( |
811 | 812 | requireWs(), |
@@ -837,7 +838,7 @@ describe("gateway config methods", () => {
|
837 | 838 | describe("gateway config.apply", () => { |
838 | 839 | it("rejects config.apply when SecretRef resolution fails", async () => { |
839 | 840 | const missingEnvVar = `OPENCLAW_MISSING_SECRETREF_APPLY_${Date.now()}`; |
840 | | -delete process.env[missingEnvVar]; |
| 841 | +deleteTestEnvValue(missingEnvVar); |
841 | 842 | const current = await getCurrentConfigObject(); |
842 | 843 | const nextConfig = configWithGatewayTokenSecretRef(current.config, missingEnvVar); |
843 | 844 | |
|