feat(2): Q4.4 ghost + DEPLOY_TIMEOUT plumb-through for heavy recipes
Harness change (small, surgical):
- runner/harness/lifecycle.deploy_app gains a deploy_timeout param (default 900s); passes
through to abra.deploy(timeout=...). For heavy recipes (ghost, matrix-synapse, lasuite-meet),
the orchestrator + dep resolver now read recipe_meta.DEPLOY_TIMEOUT and pass it so the Python
subprocess wrapping abra deploy doesn't SIGKILL it before the recipe's INTERNAL TIMEOUT
(via EXTRA_ENV) finishes swarm convergence.
- runner/run_recipe_ci.py + runner/harness/deps.py: thread recipe_meta.DEPLOY_TIMEOUT into
the per-recipe deploy_app call.
Q4.4 ghost enrollment:
- recipe_meta.py: HEALTH_PATH=/, DEPLOY_TIMEOUT=1200 (subprocess), EXTRA_ENV={TIMEOUT: 1200}
(recipe internal). Ghost cold-start with theme + DB migration runs ~12-15min on cc-ci.
- functional/test_health_check.py: GET / returns 200 (themed site).
- functional/test_content_api.py: GET /ghost/api/content/settings/ returns 200 (settings JSON)
or 401/403 (Ghost error envelope) — distinguishes ghost-server up + JSON API working from
static fallback.
- functional/test_admin_redirect.py: GET /ghost/ returns 200 or 302 + Ghost branding;
proves admin route is wired through nginx proxy.
- PARITY.md: recipe-maintainer corpus has no ghost tests/, Phase-2 health_check is the
parity baseline; create-a-post deeper test deferred (DEFERRED.md, --extra-tests linked).
Cold-verifiable (log /root/ccci-q44-ghost-r3.log):
RECIPE=ghost STAGES=install,custom cc-ci-run runner/run_recipe_ci.py
install + 3 functional tests PASS, deploy-count=1. 28/28 unit tests still PASS.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
65
tests/ghost/functional/test_admin_redirect.py
Normal file
65
tests/ghost/functional/test_admin_redirect.py
Normal file
@ -0,0 +1,65 @@
|
||||
"""ghost — recipe-specific functional test (Phase 2 P3).
|
||||
|
||||
Ghost's admin UI lives at `/ghost/`. On a fresh deploy with no owner yet, /ghost/ redirects
|
||||
(302) to the setup wizard at `/ghost/#/setup`. On a deployment with an owner already set up,
|
||||
/ghost/ shows the login form (200 with a login HTML). Either way, GET /ghost/ should NOT
|
||||
return 404 — that would indicate the admin route is not wired.
|
||||
|
||||
This test asserts /ghost/ returns 200 or 302 (admin route exists), and the response is HTML
|
||||
that references Ghost's admin client (the /ghost-assets/ path or 'ghost' in the response body).
|
||||
|
||||
Non-vacuous: a misrouted nginx returns 404; a wedged ghost-server returns 502/504; only a
|
||||
correctly-wired Ghost serves the admin SPA shell or its setup redirect.
|
||||
"""
|
||||
|
||||
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
|
||||
|
||||
|
||||
def _get_html(url: str) -> tuple[int, str]:
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
req = urllib.request.Request(url, method="GET")
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=15, context=ctx) as r:
|
||||
return r.status, r.read().decode(errors="replace")
|
||||
except urllib.error.HTTPError as e:
|
||||
# urllib doesn't auto-follow 302 by default but might raise — handle anyway
|
||||
try:
|
||||
body = e.read().decode(errors="replace")
|
||||
except Exception: # noqa: BLE001
|
||||
body = ""
|
||||
return e.code, body
|
||||
except Exception: # noqa: BLE001
|
||||
return 0, ""
|
||||
|
||||
|
||||
def test_ghost_admin_route_is_wired(live_app):
|
||||
"""GET /ghost/ → 200 or 302; body references Ghost admin (or redirects to /ghost/#/setup)."""
|
||||
url = f"https://{live_app}/ghost/"
|
||||
|
||||
def _ready():
|
||||
s, body = _get_html(url)
|
||||
if s in (200, 302) and ("ghost" in body.lower() or s == 302):
|
||||
return (s, body)
|
||||
return None
|
||||
|
||||
status_body = harness_http.assert_converges(
|
||||
_ready, f"GET {url} returns Ghost admin (200) or setup redirect (302)",
|
||||
max_wait=60, interval=3,
|
||||
)
|
||||
status, body = status_body
|
||||
assert status in (200, 302), f"unexpected status: {status}"
|
||||
if status == 200:
|
||||
# The admin SPA references /ghost-assets/ or contains "ghost" in title/body
|
||||
assert "ghost" in body.lower(), (
|
||||
f"GET {url} 200 but body has no Ghost markers: {body[:200]!r}"
|
||||
)
|
||||
44
tests/ghost/functional/test_content_api.py
Normal file
44
tests/ghost/functional/test_content_api.py
Normal file
@ -0,0 +1,44 @@
|
||||
"""ghost — recipe-specific functional test (Phase 2 P3).
|
||||
|
||||
Ghost exposes a public JSON Content API at `/ghost/api/content/settings/` which returns the
|
||||
site's public configuration (title, description, etc.) WITHOUT requiring an API key for the
|
||||
basic settings endpoint. Some Ghost versions DO require a key here — accept either:
|
||||
- 200 with JSON envelope: API alive + accessible.
|
||||
- 401/403 with JSON error: API alive + correctly gating.
|
||||
|
||||
Distinguishes "ghost-server JS process is up + serving its API" from "a static page is served
|
||||
at /" (which the parity test catches by 200).
|
||||
|
||||
A wedged Ghost backend returns 502/504 or 503. A misrouted nginx returns 404.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
|
||||
from harness import http as harness_http # noqa: E402
|
||||
|
||||
|
||||
def test_content_api_settings_endpoint(live_app):
|
||||
"""GET /ghost/api/content/settings/ → 200 or 401/403; JSON shape."""
|
||||
url = f"https://{live_app}/ghost/api/content/settings/"
|
||||
status, body = harness_http.retry_http_get(
|
||||
url, expect_status=(200, 400, 401, 403), max_wait=60, interval=3
|
||||
)
|
||||
assert status in (200, 400, 401, 403), (
|
||||
f"GET {url} HTTP {status} (expected 200/401/403, NOT 404/5xx — 404=route missing, "
|
||||
f"5xx=backend broken)"
|
||||
)
|
||||
# The API ALWAYS returns JSON (success or error envelope).
|
||||
assert body is not None, f"GET {url} returned non-JSON body"
|
||||
# On success: {"settings": {...}}. On error: {"errors": [...]}. Either shape is valid.
|
||||
if status == 200:
|
||||
assert isinstance(body, dict) and "settings" in body, (
|
||||
f"200 response missing 'settings' envelope: {body!r}"
|
||||
)
|
||||
else:
|
||||
assert isinstance(body, dict) and ("errors" in body or "message" in body or body), (
|
||||
f"error response not a proper Ghost error envelope: {body!r}"
|
||||
)
|
||||
16
tests/ghost/functional/test_health_check.py
Normal file
16
tests/ghost/functional/test_health_check.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""ghost — Phase-2 health_check (recipe-maintainer corpus has no parity test)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "runner"))
|
||||
from harness import http as harness_http # noqa: E402
|
||||
|
||||
|
||||
def test_ghost_root_serves(live_app):
|
||||
"""GET / → 200 (themed site)."""
|
||||
url = f"https://{live_app}/"
|
||||
status, _ = harness_http.retry_http_get(url, expect_status=200, max_wait=60, interval=3)
|
||||
assert status == 200, f"GET {url} HTTP {status} (expected 200)"
|
||||
Reference in New Issue
Block a user