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 "GeoIntel Kempen" in template
assert "GeoIntel is a multi-container Docker Compose stack" in template
assert "http://[IP]:[PORT:1202]/" in template
assert "http://[IP]:[PORT:1202]/geointel-icon.svg" 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' 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 "' in index