fix: isolate commitments docker state · openclaw/openclaw@9777c68
shakkernerd
·
2026-06-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,6 +15,7 @@ import {
|
15 | 15 | loadCommitmentStore, |
16 | 16 | resolveCommitmentStorePath, |
17 | 17 | } from "../../dist/commitments/store.js"; |
| 18 | +import { deleteTestEnvValue, setTestEnvValue } from "../../src/test-utils/env.js"; |
18 | 19 | |
19 | 20 | const DEFAULT_COMMITMENT_EXTRACTION_QUEUE_MAX_ITEMS = 64; |
20 | 21 | |
@@ -28,14 +29,14 @@ async function withStateDir<T>(name: string, fn: (stateDir: string) => Promise<T
|
28 | 29 | const root = await fs.mkdtemp(path.join(os.tmpdir(), `openclaw-${name}-`)); |
29 | 30 | const previousStateDir = process.env.OPENCLAW_STATE_DIR; |
30 | 31 | try { |
31 | | -process.env.OPENCLAW_STATE_DIR = root; |
| 32 | +setTestEnvValue("OPENCLAW_STATE_DIR", root); |
32 | 33 | return await fn(root); |
33 | 34 | } finally { |
34 | 35 | resetCommitmentExtractionRuntimeForTests(); |
35 | 36 | if (previousStateDir === undefined) { |
36 | | -delete process.env.OPENCLAW_STATE_DIR; |
| 37 | +deleteTestEnvValue("OPENCLAW_STATE_DIR"); |
37 | 38 | } else { |
38 | | -process.env.OPENCLAW_STATE_DIR = previousStateDir; |
| 39 | +setTestEnvValue("OPENCLAW_STATE_DIR", previousStateDir); |
39 | 40 | } |
40 | 41 | await fs.rm(root, { recursive: true, force: true }); |
41 | 42 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。