fix(swarm-test): let the backup host derive its own network mode

02_provision_inventory.sh copies the manager's host_vars to every node,
the backup host included, so a row with network=multi handed bkp-01
NETWORK_MODE=multi as well. The backup host is deployed from its own
backup.yml, which has no svc-swarm-node group and no Tor provider, so
tor_serves_host is false there and resolve_node_mode raised at the first
tls lookup: "NETWORK_MODE 'multi' needs svc-net-tor with a node onion on
this node" (01_constructor.yml, pixelfed swarm drill on the multi axis,
after a green deploy round and Playwright pass).

extend_inventory already prepares the backup host's own inventory after
the copy; it now also drops NETWORK_MODE from that host's host_vars, so
the backup host derives clearnet as a host without Tor does. The
remote-2-local pull reaches the manager over SSH and needs no onion.
Rows on clearnet or without a mode resolve as before; only the tor and
multi rows, which raised, change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-22 18:33:56 +02:00
1 parent 704c08f509
commit d080255ba1
2 files changed
+35

No files matched your search

@@ -57,6 +57,36 @@ class TestBackupLegGating(unittest.TestCase):
self.assertNotIn("svc-bkp-volume-2-local", children)
class TestBackupHostNetworkMode(unittest.TestCase):
def _backup_vars(self, seeded: dict) -> dict:
with tempfile.TemporaryDirectory() as td:
inv_path = Path(td) / "devices.yml"
vars_path = Path(td) / "host_vars" / f"{ei._BACKUP}.yml"
vars_path.parent.mkdir()
ei.dump_yaml(str(vars_path), seeded)
env = {
"SWARM_NAME": "t",
"APP_ID": "svc-registry-docker",
"INV_PATH": str(inv_path),
}
with (
mock.patch.dict("os.environ", env),
mock.patch.object(ei, "derive_includes", return_value=[]),
mock.patch.object(ei, "_host_topology", return_value=[]),
mock.patch.object(ei, "get_role_placement", return_value=""),
):
ei.main()
return ei.load_yaml_any(str(vars_path))
def test_manager_network_mode_is_dropped_from_the_backup_copy(self):
self.assertEqual(
self._backup_vars({"NETWORK_MODE": "multi", "keep": 1}), {"keep": 1}
)
def test_backup_vars_without_network_mode_stay_untouched(self):
self.assertEqual(self._backup_vars({"keep": 1}), {"keep": 1})
class TestSandboxWorkerLabelling(unittest.TestCase):
def _workers(self, kata_enabled: object) -> tuple[str, ...]:
apps = {"an-app": {"services": {"kata": {"enabled": kata_enabled}}}}