77948ef56c
The per-agent companion container (the egress/git-gate/supervise data plane run once per bottle) is the pre-consolidation architecture. Remove it and disable the backends that still depend on it, per the #385 thread. - Delete `backend/docker/sidecar_bundle.py`; docker's live path uses the consolidated shared gateway, not a per-bottle bundle. - Disable the firecracker and macos-container backends: their `launch()` fails closed (they launched a per-bottle companion; firecracker's consolidated relaunch is #354, macos follows). Their `enumerate` return empty and `cleanup` drop the companion-container discovery (firecracker keeps VMM/run-dir cleanup). - Fail-close both backends' `egress_apply` reload (it signalled the per-bottle container); consolidated egress policy resolves per-request against the orchestrator, so gateway-side apply is a follow-up. - Rename `egress_sidecar_env_entries` → `egress_gateway_env_entries`, `SIDECAR_PORTS` → `GATEWAY_PORTS`. - Move the shared DockerBottlePlan fixture to `tests/unit/_docker_bottle_plan.py`; delete tests for the removed launch paths; update cleanup/egress-apply tests. Docker consolidated launch verified end-to-end (multitenant isolation integration test passes). macos/firecracker are intentionally disabled. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBMWTEtQdJ4W5UrWuLHCck
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
"""Unit: Apple Container cleanup/enumeration helpers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import unittest
|
|
from unittest.mock import patch
|
|
|
|
from bot_bottle.backend.macos_container import cleanup, enumerate as enum_mod
|
|
from bot_bottle.backend.macos_container.bottle_cleanup_plan import (
|
|
MacosContainerBottleCleanupPlan,
|
|
)
|
|
|
|
|
|
class TestMacosContainerCleanup(unittest.TestCase):
|
|
def test_lists_prefixed_containers(self):
|
|
completed = cleanup.subprocess.CompletedProcess(
|
|
args=[],
|
|
returncode=0,
|
|
stdout="bot-bottle-a\nbot-bottle-sidecars-a\nother\n",
|
|
stderr="",
|
|
)
|
|
with patch.object(cleanup.subprocess, "run", return_value=completed):
|
|
self.assertEqual(
|
|
["bot-bottle-a", "bot-bottle-sidecars-a"],
|
|
cleanup._list_prefixed_containers(),
|
|
)
|
|
|
|
def test_cleanup_deletes_containers_and_networks(self):
|
|
plan = MacosContainerBottleCleanupPlan(
|
|
containers=("bot-bottle-a",),
|
|
networks=("bot-bottle-net-a",),
|
|
)
|
|
with patch.object(cleanup.subprocess, "run") as run:
|
|
cleanup.cleanup(plan)
|
|
self.assertEqual(
|
|
["container", "delete", "--force", "bot-bottle-a"],
|
|
run.call_args_list[0].args[0],
|
|
)
|
|
self.assertEqual(
|
|
["container", "network", "delete", "bot-bottle-net-a"],
|
|
run.call_args_list[1].args[0],
|
|
)
|
|
|
|
|
|
class TestMacosContainerEnumerate(unittest.TestCase):
|
|
def test_enumerate_active_is_empty_while_disabled(self):
|
|
# The macOS backend is disabled during the de-sidecar cleanup
|
|
# (#385); it launches nothing, so there is nothing to enumerate.
|
|
self.assertEqual([], enum_mod.enumerate_active())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|