Skip to content

Commit 6953ce5

Browse files
committed
test(openshell): report workspace cleanup failures
1 parent 5835ad3 commit 6953ce5

1 file changed

Lines changed: 41 additions & 38 deletions

File tree

‎extensions/openshell/src/backend.e2e.test.ts‎

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -804,44 +804,47 @@ describe("openshell sandbox backend e2e", () => {
804804
});
805805
}
806806
} finally {
807-
for (const sandboxName of [
808-
backend.runtimeId,
809-
mirrorBackend.runtimeId,
810-
allowBackend.runtimeId,
811-
]) {
812-
await runCommand({
813-
command: OPENCLAW_OPENSHELL_COMMAND,
814-
args: ["--workspace", openShellWorkspace, "sandbox", "delete", sandboxName],
815-
env,
816-
allowFailure: true,
817-
timeoutMs: 2 * 60_000,
818-
});
819-
}
820-
if (workspaceCreated) {
821-
await runCommand({
822-
command: OPENCLAW_OPENSHELL_COMMAND,
823-
args: ["workspace", "delete", openShellWorkspace],
824-
env,
825-
allowFailure: true,
826-
timeoutMs: 30_000,
827-
});
828-
}
829-
await hostPolicyServer?.close().catch(() => {});
830-
await fs.rm(rootDir, { recursive: true, force: true });
831-
if (previousHome === undefined) {
832-
delete process.env.HOME;
833-
} else {
834-
process.env.HOME = previousHome;
835-
}
836-
if (previousXdgConfigHome === undefined) {
837-
delete process.env.XDG_CONFIG_HOME;
838-
} else {
839-
process.env.XDG_CONFIG_HOME = previousXdgConfigHome;
840-
}
841-
if (previousXdgCacheHome === undefined) {
842-
delete process.env.XDG_CACHE_HOME;
843-
} else {
844-
process.env.XDG_CACHE_HOME = previousXdgCacheHome;
807+
// Workspace deletion verifies remote cleanup; local teardown must run even if it fails.
808+
try {
809+
for (const sandboxName of [
810+
backend.runtimeId,
811+
mirrorBackend.runtimeId,
812+
allowBackend.runtimeId,
813+
]) {
814+
await runCommand({
815+
command: OPENCLAW_OPENSHELL_COMMAND,
816+
args: ["--workspace", openShellWorkspace, "sandbox", "delete", sandboxName],
817+
env,
818+
allowFailure: true,
819+
timeoutMs: 2 * 60_000,
820+
});
821+
}
822+
if (workspaceCreated) {
823+
await runCommand({
824+
command: OPENCLAW_OPENSHELL_COMMAND,
825+
args: ["workspace", "delete", openShellWorkspace],
826+
env,
827+
timeoutMs: 30_000,
828+
});
829+
}
830+
} finally {
831+
await hostPolicyServer?.close().catch(() => {});
832+
await fs.rm(rootDir, { recursive: true, force: true });
833+
if (previousHome === undefined) {
834+
delete process.env.HOME;
835+
} else {
836+
process.env.HOME = previousHome;
837+
}
838+
if (previousXdgConfigHome === undefined) {
839+
delete process.env.XDG_CONFIG_HOME;
840+
} else {
841+
process.env.XDG_CONFIG_HOME = previousXdgConfigHome;
842+
}
843+
if (previousXdgCacheHome === undefined) {
844+
delete process.env.XDG_CACHE_HOME;
845+
} else {
846+
process.env.XDG_CACHE_HOME = previousXdgCacheHome;
847+
}
845848
}
846849
}
847850
},

0 commit comments

Comments
 (0)