feat(democracy): find the running stacks' worktrees live for the resource cleanup
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d6fb75ba22
commit
239e15b970
2 files changed
+30
-7
No files matched your search
+14
-1
@@ -59,7 +59,8 @@ class TestWatchCommands(unittest.TestCase):
|
||||
"never_block": ["^make swarm-down"],
|
||||
"cleanup": [],
|
||||
"worktree_cleanup": [],
|
||||
"worktrees": [],
|
||||
"worktrees_command": "true",
|
||||
"worktree_marker": "Makefile",
|
||||
"cache_dirs": [str(self.cache)],
|
||||
"cache_budget_percent": 3,
|
||||
"slot_need_gb": {"swarm": 30},
|
||||
@@ -128,6 +129,18 @@ class TestWatchCommands(unittest.TestCase):
|
||||
self.assertFalse(old.exists())
|
||||
self.assertTrue(new.exists())
|
||||
|
||||
def test_full_cleanup_reaches_only_marked_running_worktrees(self):
|
||||
marked, foreign = self.base / "marked", self.base / "foreign"
|
||||
for tree in (marked, foreign):
|
||||
tree.mkdir()
|
||||
(marked / "Makefile").write_text("", encoding="utf-8")
|
||||
self.cfg["worktrees_command"] = f"echo {marked}; echo {foreign}; echo {marked}"
|
||||
self.cfg["worktree_cleanup"] = ["echo x >> {worktree}/cleaned"]
|
||||
self._write_config()
|
||||
self.assertEqual(self._run("cleanup", "--full").returncode, 0)
|
||||
self.assertEqual((marked / "cleaned").read_text(encoding="utf-8"), "x\n")
|
||||
self.assertFalse((foreign / "cleaned").exists())
|
||||
|
||||
def test_without_config_every_command_is_a_no_op(self):
|
||||
self.config.unlink()
|
||||
result = self._run("status")
|
||||
|
||||
Reference in new issue
Block a user