This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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/services/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()
|
||||
Reference in New Issue
Block a user