Skip to content

Commit ab88e45

Browse files
committed
test(doctor): cover empty legacy dir startup
1 parent fe2b921 commit ab88e45

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎test/scripts/doctor-config-preflight-plugin-index.built-cli.e2e.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,30 @@ afterEach(async () => {
2525
});
2626

2727
describe("Doctor plugin index persistence built CLI proof", () => {
28+
it("starts after linking an empty legacy state dir to the canonical root", async () => {
29+
const instance = await createOpenClawTestInstance({
30+
name: "doctor-empty-legacy-state-dir",
31+
env: {
32+
OPENCLAW_CONFIG_PATH: undefined,
33+
OPENCLAW_HOME: undefined,
34+
OPENCLAW_STATE_DIR: undefined,
35+
OPENCLAW_TEST_FAST: "1",
36+
},
37+
startTimeoutMs: 90_000,
38+
});
39+
instances.push(instance);
40+
const legacyDir = path.join(instance.homeDir, ".clawdbot");
41+
fs.mkdirSync(legacyDir, { recursive: true });
42+
43+
await instance.startGateway();
44+
45+
expect(fs.realpathSync(legacyDir), instance.logs()).toBe(fs.realpathSync(instance.stateDir));
46+
47+
await instance.stopGateway();
48+
await instance.startGateway();
49+
expect(fs.realpathSync(legacyDir), instance.logs()).toBe(fs.realpathSync(instance.stateDir));
50+
}, 120_000);
51+
2852
it("starts after replacing and verifying a stale persisted Doctor index", async () => {
2953
const instance = await createOpenClawTestInstance({
3054
name: "doctor-plugin-index-persistence",

0 commit comments

Comments
 (0)