mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 13:26:04 -06:00
fix(e2e): declare agents-delete fixture owners (#123000)
This commit is contained in:
@@ -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 },
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user