fix(e2e): declare agents-delete fixture owners (#123000)

This commit is contained in:
Vincent Koc
2026-08-13 13:07:55 +08:00
committed by GitHub
parent cd0fb355c7
commit 1e7a76f49c
2 changed files with 25 additions and 0 deletions
+2
View File
@@ -30,6 +30,8 @@ function writeAgentsDeleteConfig() {
fs.mkdirSync(sharedWorkspace, { recursive: true });
writeJson(path.join(stateDir, "openclaw.json"), {
agents: {
ownership: "explicit",
defaults: { heartbeat: { agentId: "main" } },
entries: {
main: { workspace: sharedWorkspace },
ops: { workspace: sharedWorkspace },
+23
View File
@@ -21,6 +21,17 @@ function runAgentsDeleteAssert(root: string, outputPath: string, env: Record<str
});
}
function runAgentsDeleteConfig(root: string) {
const stateDir = path.join(root, "state");
const workspace = path.join(root, "workspace");
mkdirSync(stateDir, { recursive: true });
const result = spawnSync(process.execPath, [FIXTURE_SCRIPT, "agents-delete-config"], {
encoding: "utf8",
env: { ...process.env, OPENCLAW_STATE_DIR: stateDir, SHARED_WORKSPACE: workspace },
});
return { result, stateDir, workspace };
}
function runOpenWebUiWorkspace(workspaceDir: string) {
return spawnSync(process.execPath, [FIXTURE_SCRIPT, "openwebui-workspace"], {
encoding: "utf8",
@@ -32,6 +43,18 @@ function runOpenWebUiWorkspace(workspaceDir: string) {
}
describe("workspace fixture assertions", () => {
it("writes explicit owners for the shared-workspace agents", () => {
const root = tempDirs.make("openclaw-fixture-workspace-");
const { result, stateDir, workspace } = runAgentsDeleteConfig(root);
expect(result.status).toBe(0);
expect(JSON.parse(readFileSync(path.join(stateDir, "openclaw.json"), "utf8")).agents).toEqual({
ownership: "explicit",
defaults: { heartbeat: { agentId: "main" } },
entries: { main: { workspace }, ops: { workspace } },
});
});
it("prepares Open WebUI without retired workspace setup state", () => {
const root = mkdtempSync(path.join(tmpdir(), "openclaw-fixture-workspace-"));
const workspaceDir = path.join(root, "workspace");