From b4b029d2a695a4cb50a8ed3cbf5276b2a2dfb695 Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Wed, 15 Apr 2026 03:35:20 -0400 Subject: [PATCH] wip: add preview deploy regression test --- tests/test_preview_deploy.py | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/test_preview_deploy.py diff --git a/tests/test_preview_deploy.py b/tests/test_preview_deploy.py new file mode 100644 index 00000000..9b9fbff4 --- /dev/null +++ b/tests/test_preview_deploy.py @@ -0,0 +1,38 @@ +from pathlib import Path + + +ROOT = Path(__file__).resolve().parent.parent +DOCKERFILE = ROOT / "Dockerfile.preview" +NGINX_CONF = ROOT / "preview" / "nginx.conf" +DOC = ROOT / "docs" / "preview-deploy.md" +COMPOSE = ROOT / "docker-compose.yml" + + +def test_preview_deploy_files_exist(): + assert DOCKERFILE.exists(), "expected Dockerfile.preview for Nexus preview deployment" + assert NGINX_CONF.exists(), "expected preview/nginx.conf for Nexus preview deployment" + assert DOC.exists(), "expected docs/preview-deploy.md runbook" + + +def test_preview_nginx_config_proxies_websocket_and_serves_modules(): + text = NGINX_CONF.read_text(encoding="utf-8") + assert "listen 3000;" in text + assert "location /api/world/ws" in text + assert "proxy_pass http://nexus-main:8765;" in text + assert "application/javascript js;" in text + assert "try_files $uri $uri/ /index.html;" in text + + +def test_compose_exposes_preview_service(): + text = COMPOSE.read_text(encoding="utf-8") + assert "nexus-preview:" in text + assert '"3000:3000"' in text + assert "depends_on:" in text + assert "nexus-main" in text + + +def test_preview_runbook_documents_preview_url(): + text = DOC.read_text(encoding="utf-8") + assert "http://localhost:3000" in text + assert "docker compose up -d nexus-main nexus-preview" in text + assert "/api/world/ws" in text