Files
geointel/backend/tests/test_sprint31_unraid_template.py
T
Codex 3a8b82f59a
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled
Add Unraid deployment template
2026-06-17 04:22:38 +02:00

64 lines
2.6 KiB
Python

from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def test_unraid_template_documents_editable_runtime_settings() -> None:
template = (ROOT / "deploy" / "unraid" / "geointel-unraid-template.xml").read_text(encoding="utf-8")
assert "<Name>GeoIntel Kempen</Name>" in template
assert "GeoIntel is a multi-container Docker Compose stack" in template
assert "<WebUI>http://[IP]:[PORT:1202]/</WebUI>" in template
assert "<Icon>http://[IP]:[PORT:1202]/geointel-icon.svg</Icon>" in template
assert 'Target="GEOINTEL_FRONTEND_PORT"' in template
assert 'Target="GEOINTEL_BACKEND_PORT"' in template
assert 'Target="GEOINTEL_STORAGE_PATH"' in template
assert 'Target="GEOINTEL_POSTGRES_PASSWORD"' in template
assert 'Mask="true">change-me-before-shared-use</Config>' in template
def test_unraid_env_template_matches_compose_variables() -> None:
compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8")
env_template = (ROOT / "deploy" / "unraid" / "geointel.env.example").read_text(encoding="utf-8")
for key in (
"GEOINTEL_FRONTEND_PORT",
"GEOINTEL_BACKEND_PORT",
"GEOINTEL_STORAGE_PATH",
"GEOINTEL_POSTGRES_DB",
"GEOINTEL_POSTGRES_USER",
"GEOINTEL_POSTGRES_PASSWORD",
"GEOINTEL_CORS_ORIGINS",
"GEOINTEL_MAX_UPLOAD_MB",
):
assert key in compose
assert f"{key}=" in env_template
assert "GEOINTEL_FRONTEND_PORT=1202" in env_template
assert "GEOINTEL_STORAGE_PATH=/mnt/user/appdata/geointel/storage" in env_template
def test_unraid_readme_explains_port_changes_and_safe_cleanup() -> None:
readme = (ROOT / "deploy" / "unraid" / "README.md").read_text(encoding="utf-8")
assert "cp deploy/unraid/geointel.env.example .env" in readme
assert "GEOINTEL_FRONTEND_PORT=1203" in readme
assert "docker compose up -d --build" in readme
assert "bash scripts/live_migration_smoke.sh" in readme
assert "docker builder prune -af" in readme
assert "Avoid broad volume pruning" in readme
def test_frontend_and_unraid_icon_assets_are_present() -> None:
deploy_icon = (ROOT / "deploy" / "unraid" / "geointel-icon.svg").read_text(encoding="utf-8")
frontend_icon = (ROOT / "frontend" / "public" / "geointel-icon.svg").read_text(encoding="utf-8")
index = (ROOT / "frontend" / "index.html").read_text(encoding="utf-8")
assert "<svg" in deploy_icon
assert "GeoIntel Kempen" in deploy_icon
assert deploy_icon == frontend_icon
assert '<link rel="icon" type="image/svg+xml" href="/geointel-icon.svg" />' in index