315ed04979
tracker-policy-pr / check-pr (pull_request) Successful in 8s
test / integration-docker (pull_request) Successful in 15s
test / unit (pull_request) Successful in 38s
lint / lint (push) Successful in 54s
test / integration-firecracker (pull_request) Successful in 4m21s
test / coverage (pull_request) Successful in 24s
test / publish-infra (pull_request) Has been skipped
- Replace test_all_install_podman with test_none_install_podman: agent images intentionally no longer include podman; the nested-containers derived layer is where it lives (see build_image in nested_containers.py). - Add podman to the package assertions in test_macos_nested_containers so its presence in the derived Dockerfile is explicitly verified. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
"""Unit contracts shared by all built-in agent images."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
_CONTRIB_DIR = Path(__file__).resolve().parents[2] / "bot_bottle/contrib"
|
|
_AGENT_DOCKERFILES = tuple(sorted(_CONTRIB_DIR.glob("*/Dockerfile")))
|
|
|
|
|
|
class TestBuiltinAgentImages(unittest.TestCase):
|
|
def test_all_use_debian_trixie_stable(self):
|
|
self.assertTrue(_AGENT_DOCKERFILES)
|
|
for dockerfile in _AGENT_DOCKERFILES:
|
|
with self.subTest(provider=dockerfile.parent.name):
|
|
self.assertRegex(
|
|
dockerfile.read_text(),
|
|
r"(?m)^FROM node:22-trixie-slim\s*$",
|
|
)
|
|
|
|
def test_none_install_podman(self):
|
|
# podman lives in the nested-containers derived layer (nested_containers.py),
|
|
# not in the base agent images, so bottles without the flag pay no cost.
|
|
for dockerfile in _AGENT_DOCKERFILES:
|
|
with self.subTest(provider=dockerfile.parent.name):
|
|
self.assertNotRegex(
|
|
dockerfile.read_text(),
|
|
re.compile(r"(?m)^\s*podman(?:\s|\\|$)"),
|
|
)
|
|
|
|
def test_all_install_ssh_client(self):
|
|
for dockerfile in _AGENT_DOCKERFILES:
|
|
with self.subTest(provider=dockerfile.parent.name):
|
|
self.assertRegex(
|
|
dockerfile.read_text(),
|
|
re.compile(r"(?m)^\s*openssh-client(?:\s|\\|$)"),
|
|
)
|
|
|
|
def test_all_prepare_node_git_config_directory(self):
|
|
for dockerfile in _AGENT_DOCKERFILES:
|
|
with self.subTest(provider=dockerfile.parent.name):
|
|
dockerfile_text = dockerfile.read_text()
|
|
self.assertIn("install -d -o node -g node", dockerfile_text)
|
|
self.assertIn("/home/node/.config/git", dockerfile_text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|