From dc6fc6953ac197cdd32f85ac7b04595779130bc2 Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 13 May 2026 15:53:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=88=E4=BD=8F=E6=A0=B8=E5=BF=83=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E8=B3=87=E6=BA=90=E8=88=87=E5=81=A5=E5=BA=B7=E6=AA=A2?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_docker_compose_runtime_mounts.py | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/test_docker_compose_runtime_mounts.py b/tests/test_docker_compose_runtime_mounts.py index c507361..d479e9b 100644 --- a/tests/test_docker_compose_runtime_mounts.py +++ b/tests/test_docker_compose_runtime_mounts.py @@ -1,10 +1,21 @@ from pathlib import Path +import re ROOT = Path(__file__).resolve().parents[1] DOCKER_COMPOSE = ROOT / "docker-compose.yml" +def _service_block(compose: str, service_name: str) -> str: + match = re.search( + rf"^ {re.escape(service_name)}:\n(?P.*?)(?=^ [A-Za-z0-9_-]+:\n|\Z)", + compose, + flags=re.MULTILINE | re.DOTALL, + ) + assert match, f"{service_name} service block missing" + return match.group("body") + + def test_momo_app_mounts_gunicorn_config_for_sync_deploys(): compose = DOCKER_COMPOSE.read_text(encoding="utf-8") @@ -12,3 +23,19 @@ def test_momo_app_mounts_gunicorn_config_for_sync_deploys(): assert "- ./gunicorn.conf.py:/app/gunicorn.conf.py:ro" in compose assert "- ./static:/app/static:ro" in compose assert "- ./web/static:/app/web/static:ro" in compose + + +def test_core_runtime_services_keep_memory_limits_and_healthchecks(): + compose = DOCKER_COMPOSE.read_text(encoding="utf-8") + expected_mem_limits = { + "momo-app": "mem_limit: 2g", + "scheduler": "mem_limit: 2g", + "telegram-bot": "mem_limit: 512m", + } + + for service_name, expected_mem_limit in expected_mem_limits.items(): + block = _service_block(compose, service_name) + assert expected_mem_limit in block + assert "healthcheck:" in block + + assert 'curl", "-f", "http://localhost:80/health"' in _service_block(compose, "momo-app")