Files
EmailToDiscord/tests/test_deployment.py
T
yotta d906dc05a9
Validate and publish container image / build (pull_request) Successful in 3m24s
Harborプロジェクトをknative-funcに変更
2026-07-18 09:08:04 +09:00

36 lines
1.2 KiB
Python

import re
import unittest
from pathlib import Path
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
class ContainerToolsDeploymentTests(unittest.TestCase):
def test_deployment_compose_uses_prebuilt_image_only(self):
compose = (REPOSITORY_ROOT / "docker-compose.yml").read_text(encoding="utf-8")
self.assertIn(
"image: harbor.mukan.0am.jp/knative-func/email-to-discord:latest",
compose,
)
self.assertIn("host.docker.internal:host-gateway", compose)
for forbidden_key in ("build", "container_name", "env_file"):
self.assertIsNone(
re.search(rf"^\s+{forbidden_key}:", compose, flags=re.MULTILINE),
f"container_toolsで禁止されている'{forbidden_key}'が含まれています",
)
def test_local_compose_keeps_source_build_support(self):
compose = (REPOSITORY_ROOT / "docker-compose.local.yml").read_text(
encoding="utf-8"
)
self.assertRegex(compose, r"(?m)^\s+build:")
self.assertIn("target: runtime", compose)
self.assertIn("host.docker.internal:host-gateway", compose)
if __name__ == "__main__":
unittest.main()