dfce3d9505
lint / lint (push) Successful in 54s
The `DockerGateway` container-lifecycle impl now lives in `backend/docker/gateway.py` (the shape backend gateway classes will share); `orchestrator/gateway.py` keeps only the backend-neutral pieces (the `Gateway` ABC, constants, `rotate_gateway_ca`). Delete the standalone-gateway path it was the only consumer of. `--gateway` on `python -m bot_bottle.orchestrator` was invoked nowhere — the production docker flow runs the gateway data plane inside the combined `bot-bottle-infra` container via `OrchestratorService`, never this class. Removing it takes with it `Orchestrator.ensure_gateway()` and the `gateway` ctor arg; `gateway_status()` becomes a stub reporting `configured: false` so the documented `GET /gateway` control-plane route keeps its contract. Fix a latent bug the move surfaced: `launch.py` read the shared gateway CA via `docker exec bot-bottle-orch-gateway`, a container the consolidated flow never creates — so the agent CA install was reaching a nonexistent name. Read it from `bot-bottle-infra` (INFRA_NAME) instead. Repoint the affected tests to the new module; drop the unit test + fake that covered the deleted standalone wiring. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Integration: DockerGateway.image_exists reflects real docker state.
|
|
|
|
Gated on a reachable Docker daemon. Deliberately does NOT build the full
|
|
gateway (a heavy, slow image build) — it exercises the `image_exists`
|
|
primitive that `ensure_built` gates on, against a tiny pulled image and a
|
|
name that can't exist.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import unittest
|
|
|
|
from bot_bottle.backend.docker.gateway import DockerGateway
|
|
from tests._docker import skip_unless_docker
|
|
|
|
IMAGE = "busybox"
|
|
|
|
|
|
@skip_unless_docker()
|
|
class TestDockerGatewayImageExists(unittest.TestCase):
|
|
def test_image_exists_true_for_present_false_for_absent(self) -> None:
|
|
# Ensure the tiny image is present (build_if_missing is disabled here
|
|
# so this never triggers a Dockerfile.gateway build).
|
|
subprocess.run(
|
|
["docker", "pull", IMAGE],
|
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False,
|
|
)
|
|
self.assertTrue(DockerGateway(IMAGE, dockerfile=None).image_exists())
|
|
self.assertFalse(
|
|
DockerGateway("bot-bottle-nonexistent:doesnotexist", dockerfile=None).image_exists()
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|