Some checks failed
continuous-integration/drone/push Build is failing
New recipe recipe-maintainers/Libre-Desk (abra TYPE=libredesk): app libredesk v2.4.0 on :9000 + postgres:17 + redis:7. Adds: - recipe_meta.py: /health probe, BACKUP_CAPABLE (backupbot db labels), upgrade EXPECTED_NA (only one published version so far), WARM_CANONICAL. - install_steps.sh: insert format-compliant enc_key (32-hex) + admin_pwd (upper+lower+num+special) before deploy — abra's generic generator doesn't satisfy LibreDesk's strict secret formats. - custom/: /health 200 probe + served-shell brand/asset probe (real app, not a fallback 200).
50 lines
1.8 KiB
Python
50 lines
1.8 KiB
Python
"""libredesk — UI probe: the served root HTML is the real LibreDesk app, not a fallback page.
|
|
|
|
/health passing only proves the process is up. This asserts the front-end SPA is actually bound and
|
|
serving its own shell — a wedged backend or a misrouted proxy would 200 with generic/empty content.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import ssl
|
|
import sys
|
|
import urllib.request
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
|
|
from harness import http as harness_http # noqa: E402
|
|
|
|
_CTX = ssl.create_default_context()
|
|
_CTX.check_hostname = False
|
|
_CTX.verify_mode = ssl.CERT_NONE
|
|
|
|
|
|
def _get_body(url: str) -> tuple[int, str]:
|
|
req = urllib.request.Request(url, method="GET")
|
|
with urllib.request.urlopen(req, timeout=15, context=_CTX) as r:
|
|
return r.status, r.read().decode(errors="replace")
|
|
|
|
|
|
def test_libredesk_serves_app_shell(live_app):
|
|
"""GET /; assert LibreDesk-specific brand or SPA-asset markers in the served HTML."""
|
|
url = f"https://{live_app}/"
|
|
|
|
def _ready():
|
|
try:
|
|
status, body = _get_body(url)
|
|
except Exception: # noqa: BLE001
|
|
return None
|
|
return body if status in (200, 301, 302) else None
|
|
|
|
body = harness_http.assert_converges(_ready, f"GET {url}", max_wait=120, interval=5)
|
|
lower = body.lower()
|
|
|
|
# Brand markers: the app title / meta / bundle references carry "libredesk".
|
|
brand = [m for m in ("libredesk", "libre desk") if m in lower]
|
|
# SPA asset markers: the built front-end serves hashed JS/CSS bundles + a favicon.
|
|
assets = [m for m in ("/assets/", "favicon", ".js", ".css", "<div id=\"app\"", "id=app") if m in body]
|
|
|
|
assert brand or assets, (
|
|
f"GET {url} HTML has no LibreDesk brand or SPA-asset markers. Excerpt: {body[:300]!r}"
|
|
)
|