fix(docker): enumerate the active infra network
tracker-policy-pr / check-pr (pull_request) Successful in 21s
test / image-input-builds (pull_request) Successful in 59s
test / unit (pull_request) Successful in 1m2s
test / integration-docker (pull_request) Successful in 1m2s
test / coverage (pull_request) Successful in 15s
lint / lint (push) Successful in 58s
tracker-policy-pr / check-pr (pull_request) Successful in 21s
test / image-input-builds (pull_request) Successful in 59s
test / unit (pull_request) Successful in 1m2s
test / integration-docker (pull_request) Successful in 1m2s
test / coverage (pull_request) Successful in 15s
lint / lint (push) Successful in 58s
This commit is contained in:
@@ -163,8 +163,12 @@ class DockerBottleBackend(BottleBackend["DockerBottlePlan", "DockerBottleCleanup
|
||||
return GatewayAttachResources(ca_pem=infra.gateway().ca_cert_pem())
|
||||
|
||||
def _running_bottles(self) -> Sequence[str]:
|
||||
from .infra import DockerInfraService
|
||||
from .infra_launch import running_agent_containers
|
||||
return running_agent_containers()
|
||||
infra = self._infra if self._infra is not None else DockerInfraService()
|
||||
return running_agent_containers(
|
||||
network=infra.network, gateway_name=infra.gateway().name,
|
||||
)
|
||||
|
||||
def _attach_bottle_to_gateway(
|
||||
self, bottle: str, resources: GatewayAttachResources,
|
||||
|
||||
@@ -297,6 +297,16 @@ class TestDockerAttachPrimitives(unittest.TestCase):
|
||||
self.assertEqual("ITEST-CA", res.ca_pem)
|
||||
infra.gateway.assert_called_once()
|
||||
|
||||
def test_running_bottles_uses_the_threaded_infra_network(self) -> None:
|
||||
from bot_bottle.backend.docker.backend import DockerBottleBackend
|
||||
infra = Mock(network="itest-network")
|
||||
infra.gateway.return_value.name = "itest-gateway"
|
||||
with patch.object(docker, "running_agent_containers") as running:
|
||||
DockerBottleBackend(infra=infra)._running_bottles()
|
||||
running.assert_called_once_with(
|
||||
network="itest-network", gateway_name="itest-gateway",
|
||||
)
|
||||
|
||||
def test_gateway_attach_resources_defaults_to_the_host_singleton(self) -> None:
|
||||
# Ordinary construction (no infra) falls back to the per-host default.
|
||||
from bot_bottle.backend.docker.backend import DockerBottleBackend
|
||||
|
||||
Reference in New Issue
Block a user