- tests/n8n/PARITY.md: parity table (health_check ported) + 2 recipe-specific functional tests with rationale + data-integrity section pointing to Phase-1d/1e lifecycle overlays. - tests/n8n/functional/test_health_check.py: parity port of recipe-info/n8n/tests/health_check.py — SOURCE comment. - tests/n8n/functional/test_rest_settings.py: NEW recipe-specific — polls /rest/settings until response is application/json (not the 'n8n is starting up' SPA placeholder); asserts known n8n public-settings keys (userManagement/defaultLocale/authCookie) in the 'data' envelope. Proves the editor SPA's primary API contract is intact. - tests/n8n/functional/test_login_state.py: NEW recipe-specific — polls /rest/login until response is JSON; proves the user-management/auth subsystem initialized on top of the public-settings layer. - tests/n8n/test_install.py: install overlay's Playwright now polls page.goto until status==200 (n8n's / route can return 404 briefly while the SPA route registers on top of /healthz=200). Bounded poll, no bare sleep, raise on persistent failure — same robustness pattern as Phase-1e exec_in_app. Cold-verifiable on cc-ci (log /root/ccci-q1-n8n-r3.log): RECIPE=n8n cc-ci-run runner/run_recipe_ci.py all 5 stages PASS, deploy-count=1, head_ref=63dd3e0f==chaos-version=63dd3e0f, version 3.1.0+2.9.4 -> 3.2.0+2.20.6 (HC1 non-vacuous), 5 lifecycle assertions + 3 custom-stage assertions all PASS. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
2.2 KiB
Python
53 lines
2.2 KiB
Python
"""n8n — INSTALL overlay (Phase 1d, DG4): override + extend-by-composition.
|
|
|
|
Reuses the generic "really serving" assertion, then ADDS the recipe-specific checks: /healthz answers
|
|
200, and a real browser loads the live n8n editor SPA over HTTPS (D2 install + D3 Playwright).
|
|
Assertion-only on the shared deployment."""
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
|
|
from harness import generic, lifecycle # noqa: E402
|
|
|
|
|
|
def test_serving_and_editor(live_app, meta):
|
|
# extend-by-composition: reuse the generic "really serving" assertion first ...
|
|
generic.assert_serving(live_app, meta)
|
|
|
|
# ... then the recipe-specific assertions.
|
|
status = lifecycle.http_get(live_app, "/healthz")
|
|
assert status == 200, f"expected 200 from {live_app}/healthz, got {status}"
|
|
|
|
# A real browser loads the live n8n editor SPA over HTTPS.
|
|
# n8n's boot is staged: /healthz returns 200 before / route is registered. So we may briefly
|
|
# get 404 from /, then a 200 with the "starting up" placeholder, then the actual SPA. Poll
|
|
# page.goto until status==200 (route registered) — Phase 1e exec_in_app pattern: bounded poll,
|
|
# no bare sleep, raise on persistent failure.
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
url = f"https://{live_app}/"
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(args=["--no-sandbox"])
|
|
try:
|
|
ctx = browser.new_context(ignore_https_errors=True)
|
|
page = ctx.new_page()
|
|
import time
|
|
|
|
deadline = time.time() + 120
|
|
resp = None
|
|
last_status = 0
|
|
while time.time() < deadline:
|
|
resp = page.goto(url, wait_until="domcontentloaded", timeout=30000)
|
|
last_status = resp.status if resp is not None else 0
|
|
if last_status in (200, 304):
|
|
break
|
|
time.sleep(3)
|
|
assert resp is not None and last_status in (200, 304), (
|
|
f"page status {last_status} after polling — n8n route never came up"
|
|
)
|
|
body = page.content().lower()
|
|
assert "n8n" in body or "<html" in body, "no n8n content served"
|
|
finally:
|
|
browser.close()
|