Split host setup into explicit entity actions

This commit is contained in:
deytenit committed 2026-11-08 12:39:49 +03:00
1 parent a297e7c71e
commit ba9ef92051
51 files changed
+1023 -275

No files matched your search

+19 -11
View File
@@ -17,15 +17,15 @@ class TestOverlay(unittest.TestCase):
self.prop = tempfile.mkdtemp()
def test_commons_only(self):
_write(self.commons, "configure/ufw.py", ACT.format(s="commons ufw", r="C"))
r = overlay.resolve("configure/ufw", self.commons, self.prop)
_write(self.commons, "config/ufw.py", ACT.format(s="commons ufw", r="C"))
r = overlay.resolve("config/ufw", self.commons, self.prop)
self.assertIsNotNone(r); self.assertIsNone(r.shadowed)
self.assertTrue(r.path.startswith(self.commons))
def test_override_exposes_shadowed(self):
_write(self.commons, "configure/ufw.py", ACT.format(s="commons", r="C"))
_write(self.prop, "configure/ufw.py", ACT.format(s="local", r="L"))
r = overlay.resolve("configure/ufw", self.commons, self.prop)
_write(self.commons, "config/ufw.py", ACT.format(s="commons", r="C"))
_write(self.prop, "config/ufw.py", ACT.format(s="local", r="L"))
r = overlay.resolve("config/ufw", self.commons, self.prop)
self.assertTrue(r.path.startswith(self.prop)) # local wins
self.assertTrue(r.shadowed.startswith(self.commons))
@@ -33,17 +33,25 @@ class TestOverlay(unittest.TestCase):
self.assertIsNone(overlay.resolve("no/such", self.commons, self.prop))
def test_discover_marks_sources_and_disabled(self):
_write(self.commons, "configure/ufw.py", ACT.format(s="commons ufw", r="C"))
_write(self.commons, "sync/repository.py", ACT.format(s="sync repo", r="C"))
_write(self.prop, "configure/ufw.py", ACT.format(s="local ufw", r="L"))
_write(self.commons, "config/ufw.py", ACT.format(s="commons ufw", r="C"))
_write(self.commons, "repository/sync.py", ACT.format(s="sync repo", r="C"))
_write(self.prop, "config/ufw.py", ACT.format(s="local ufw", r="L"))
_write(self.prop, "sync/minecraft.py",
'from engine.descriptor import Meta\nMETADATA = Meta(summary="mc")\nDISABLED = "wip"\ndef run(ctx, args): pass\n')
infos = {i.name: i for i in overlay.discover(self.commons, self.prop)}
self.assertEqual(infos["configure/ufw"].source, "override")
self.assertEqual(infos["sync/repository"].source, "commons")
self.assertEqual(infos["config/ufw"].source, "override")
self.assertEqual(infos["repository/sync"].source, "commons")
self.assertEqual(infos["sync/minecraft"].source, "local")
self.assertEqual(infos["sync/minecraft"].disabled, "wip")
self.assertEqual(infos["configure/ufw"].summary, "local ufw")
self.assertEqual(infos["config/ufw"].summary, "local ufw")
def test_only_entity_action_paths_can_be_listed_and_dispatched(self):
for name in ("configure", "config/nested/tool", "config/tool"):
_write(self.prop, name + ".py", ACT.format(s="test", r="ok"))
names = [item.name for item in overlay.discover(self.commons, self.prop)]
self.assertEqual(names, ["config/tool"])
for name in ("configure", "config/nested/tool", "config/../configure"):
self.assertIsNone(overlay.resolve(name, self.commons, self.prop))
def test_load_module_runs(self):
p = _write(self.commons, "x/y.py", ACT.format(s="s", r="Z"))