fix(macos-container): mount live egress routes dir
lint / lint (push) Failing after 1m35s
test / unit (pull_request) Successful in 33s
test / integration (pull_request) Successful in 16s

This commit is contained in:
2026-06-23 01:39:29 -04:00
parent 0ec1085238
commit eb3e64ea8f
5 changed files with 42 additions and 8 deletions
+28 -1
View File
@@ -90,13 +90,40 @@ class TestApplyRoutesChange(unittest.TestCase):
self.assertEqual("routes:\n - host: google.com\n", after)
self.assertEqual(
"routes:\n - host: google.com\n",
(Path(self._tmp.name) / ".bot-bottle/state/dev/egress/egress_routes.yaml").read_text(encoding="utf-8"),
(Path(self._tmp.name) / ".bot-bottle/state/dev/egress/routes.yaml").read_text(encoding="utf-8"),
)
self.assertEqual(
["docker", "kill", "--signal", "HUP", "bot-bottle-sidecars-dev"],
calls[0],
)
def test_updates_legacy_routes_file_when_existing_bottle_mounted_it(self):
legacy_path = (
Path(self._tmp.name)
/ ".bot-bottle/state/dev/egress/egress_routes.yaml"
)
legacy_path.parent.mkdir(parents=True)
legacy_path.write_text("routes: []\n", encoding="utf-8")
with patch(
"bot_bottle.backend.docker.egress_apply.subprocess.run",
return_value=SimpleNamespace(returncode=0, stdout="", stderr=""),
):
before, after = apply_routes_change(
"dev",
"routes:\n - host: google.com\n",
)
self.assertEqual("routes: []\n", before)
self.assertEqual("routes:\n - host: google.com\n", after)
self.assertEqual(
"routes:\n - host: google.com\n",
legacy_path.read_text(encoding="utf-8"),
)
self.assertFalse(
(Path(self._tmp.name) / ".bot-bottle/state/dev/egress/routes.yaml").exists(),
)
if __name__ == "__main__":
unittest.main()
+2 -2
View File
@@ -27,7 +27,7 @@ def _plan(
agent_git_gate_url: str = "",
agent_supervise_url: str = "",
) -> MacosContainerBottlePlan:
routes_path = stage_dir / "source-routes.yaml"
routes_path = stage_dir / "routes.yaml"
routes_path.write_text("routes: []\n", encoding="utf-8")
ca_dir = stage_dir / "egress-ca"
ca_dir.mkdir(exist_ok=True)
@@ -126,7 +126,7 @@ class TestMacosContainerLaunchArgv(unittest.TestCase):
argv,
)
self.assertIn(
f"type=bind,source={self.stage_dir / 'source-routes.yaml'},target=/etc/egress/routes.yaml,readonly",
f"type=bind,source={self.stage_dir},target=/etc/egress,readonly",
argv,
)
self.assertIn(