Files
Jyotisha/tests/test_railway_deployment.py
T
Jesse_Chen 124d3990b2
Independent Staging Quality Gate / validate (push) Failing after 12m34s
Independent Staging Quality Gate / publish (push) Has been skipped
fix(api): persist scratch/local and bound heavy compute concurrency
Keep async job and chart-cache files across API recreates, freeze jyotish_api_server.py growth, and fail fast with 429 when rectification or high-rigor compute is saturated.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-02 06:12:23 +08:00

40 lines
1.6 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_railway_services_use_the_product_frontend_and_dynamic_ports() -> None:
web = (ROOT / "deploy" / "railway-web.Dockerfile").read_text(encoding="utf-8")
api = (ROOT / "deploy" / "railway-api.Dockerfile").read_text(encoding="utf-8")
assert "COPY frontend/package.json frontend/package-lock.json" in web
assert "HOSTNAME=0.0.0.0" in web
assert 'CMD ["node", "server.js"]' in web
assert "next-env.d.ts" not in web
assert "FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/python:3.12-slim" in api
assert "daocloud" not in api.lower()
assert "COPY SKILL.md mcp_server.py" in api
assert "--host 0.0.0.0" in api and "${PORT:-5200}" in api
assert "http.server" not in api
assert "FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/node:22-alpine" in web
assert "daocloud" not in web.lower()
def test_web_image_copies_postcss_config_before_building_frontend() -> None:
web = (ROOT / "deploy" / "railway-web.Dockerfile").read_text(encoding="utf-8")
config_copy = "COPY frontend/next.config.ts frontend/postcss.config.mjs frontend/tsconfig.json ./"
assert config_copy in web
assert web.index(config_copy) < web.index("RUN npm run build")
def test_server_compose_allows_only_the_internal_api_hostname() -> None:
compose = (ROOT / "deploy" / "docker-compose.server.yml").read_text(encoding="utf-8")
assert "JYOTISH_ALLOWED_HOSTS: localhost,127.0.0.1,::1,api" in compose
assert "api_scratch:/app/scratch/local" in compose
assert " api_scratch:" in compose