e0b0429cd1
Retire "sidecar" for the consolidated per-host path (PRD 0070 naming decision): the orchestrator is the umbrella/control plane, and the egress/git/supervise data-plane unit it runs is the "gateway". - git mv sidecar.py -> gateway.py and the two integration + one unit test files; DockerSidecar->DockerGateway, Sidecar->Gateway, SidecarError->GatewayError, SIDECAR_*->GATEWAY_*, ensure_sidecar-> ensure_gateway, sidecar_status->gateway_status, container name bot-bottle-orch-sidecar->bot-bottle-orch-gateway. - Prose rename across broker/registry/egress/policy_resolver + PRD 0070. - Preserved: the image name bot-bottle-sidecars, the BOT_BOTTLE_SIDECAR_IMAGE env var, Dockerfile.sidecars, and PRD 0069's own stage-name cross-references (that doc still uses "sidecar"). No behavior change. Full unit suite green (1679 tests; the 13 test_sidecar_init /bin/sleep errors are pre-existing NixOS-local noise). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBMWTEtQdJ4W5UrWuLHCck
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
|
|
sidecar bundle (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.orchestrator.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.sidecars 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()
|