Skip to content

Commit f0f5da0

Browse files
committed
test: keep commitments client boundary
1 parent 9777c68 commit f0f5da0

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

scripts/e2e/commitments-safety-docker-client.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
loadCommitmentStore,
1616
resolveCommitmentStorePath,
1717
} from "../../dist/commitments/store.js";
18-
import { deleteTestEnvValue, setTestEnvValue } from "../../src/test-utils/env.js";
1918

2019
const DEFAULT_COMMITMENT_EXTRACTION_QUEUE_MAX_ITEMS = 64;
2120

@@ -25,18 +24,26 @@ function assert(condition: unknown, message: string): asserts condition {
2524
}
2625
}
2726

27+
function setEnvValue(key: string, value: string): void {
28+
Reflect.set(process.env, key, value);
29+
}
30+
31+
function deleteEnvValue(key: string): void {
32+
Reflect.deleteProperty(process.env, key);
33+
}
34+
2835
async function withStateDir<T>(name: string, fn: (stateDir: string) => Promise<T>): Promise<T> {
2936
const root = await fs.mkdtemp(path.join(os.tmpdir(), `openclaw-${name}-`));
3037
const previousStateDir = process.env.OPENCLAW_STATE_DIR;
3138
try {
32-
setTestEnvValue("OPENCLAW_STATE_DIR", root);
39+
setEnvValue("OPENCLAW_STATE_DIR", root);
3340
return await fn(root);
3441
} finally {
3542
resetCommitmentExtractionRuntimeForTests();
3643
if (previousStateDir === undefined) {
37-
deleteTestEnvValue("OPENCLAW_STATE_DIR");
44+
deleteEnvValue("OPENCLAW_STATE_DIR");
3845
} else {
39-
setTestEnvValue("OPENCLAW_STATE_DIR", previousStateDir);
46+
setEnvValue("OPENCLAW_STATE_DIR", previousStateDir);
4047
}
4148
await fs.rm(root, { recursive: true, force: true });
4249
}

0 commit comments

Comments
 (0)