mirror of https://github.com/openclaw/openclaw.git
test: ignore stale isolated state dir in live env staging
This commit is contained in:
parent
0e0945c5ed
commit
225d58b74a
|
|
@ -50,6 +50,7 @@ afterEach(() => {
|
|||
describe("installTestEnv", () => {
|
||||
it("keeps live tests on a temp HOME while copying config and auth state", () => {
|
||||
const realHome = createTempHome();
|
||||
const priorIsolatedHome = createTempHome();
|
||||
writeFile(path.join(realHome, ".profile"), "export TEST_PROFILE_ONLY=from-profile\n");
|
||||
writeFile(
|
||||
path.join(realHome, "custom-openclaw.json5"),
|
||||
|
|
@ -87,6 +88,8 @@ describe("installTestEnv", () => {
|
|||
process.env.OPENCLAW_LIVE_TEST = "1";
|
||||
process.env.OPENCLAW_LIVE_TEST_QUIET = "1";
|
||||
process.env.OPENCLAW_CONFIG_PATH = "~/custom-openclaw.json5";
|
||||
process.env.OPENCLAW_TEST_HOME = priorIsolatedHome;
|
||||
process.env.OPENCLAW_STATE_DIR = path.join(priorIsolatedHome, ".openclaw");
|
||||
|
||||
const testEnv = installTestEnv();
|
||||
cleanupFns.push(testEnv.cleanup);
|
||||
|
|
|
|||
|
|
@ -277,9 +277,20 @@ function stageLiveTestState(params: {
|
|||
realHome: string;
|
||||
tempHome: string;
|
||||
}): void {
|
||||
const realStateDir = params.env.OPENCLAW_STATE_DIR?.trim()
|
||||
? resolveHomeRelativePath(params.env.OPENCLAW_STATE_DIR, params.realHome)
|
||||
const rawStateDir = params.env.OPENCLAW_STATE_DIR?.trim();
|
||||
let realStateDir = rawStateDir
|
||||
? resolveHomeRelativePath(rawStateDir, params.realHome)
|
||||
: path.join(params.realHome, ".openclaw");
|
||||
const priorIsolatedHome = params.env.OPENCLAW_TEST_HOME?.trim();
|
||||
const snapshotHome = params.env.HOME?.trim();
|
||||
if (
|
||||
priorIsolatedHome &&
|
||||
snapshotHome &&
|
||||
snapshotHome !== priorIsolatedHome &&
|
||||
realStateDir === path.join(priorIsolatedHome, ".openclaw")
|
||||
) {
|
||||
realStateDir = path.join(params.realHome, ".openclaw");
|
||||
}
|
||||
const tempStateDir = path.join(params.tempHome, ".openclaw");
|
||||
fs.mkdirSync(tempStateDir, { recursive: true });
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue