Files
cc-ci/tests/mattermost-lts/recipe_meta.py

49 lines
2.6 KiB
Python

# Per-recipe harness config for mattermost-lts (Phase 2 Q4.5 — team chat / collaboration platform).
#
# Stack (compose.yml): app (mattermost/mattermost-team-edition) + postgres (postgres:15-alpine,
# bundled IN-STACK — NOT an external dep). HTTP-native: the app serves the web UI + REST API
# (/api/v4/...) at `/` through Traefik. No reference corpus under recipe-info/ → P2 (parity) is
# vacuously satisfied; coverage is ≥2 recipe-specific functional tests (P3) on the proven HTTP harness.
#
# Health: mattermost serves its web app at `/`. A fresh server with no users redirects `/` toward the
# setup/login flow (302) or serves the SPA shell (200); accept both. The dedicated liveness endpoint
# is GET /api/v4/system/ping -> {"status":"OK"} (exercised as a functional test, not the install gate).
HEALTH_PATH = "/"
HEALTH_OK = (200, 302)
# mattermost first-boot runs DB migrations against a fresh postgres volume; the default abra
# convergence TIMEOUT (300s) is tight on cc-ci's single node (postgres init + app migrate + plugin
# unpack). Bump, kept under DEPLOY_TIMEOUT so abra finishes its convergence wait before the Python
# subprocess timeout.
DEPLOY_TIMEOUT = 900
HTTP_TIMEOUT = 600
EXTRA_ENV = {"TIMEOUT": "600"}
def SCREENSHOT(page, ctx):
"""Land the real sign-in form for the CI card (phase-shot). Mattermost serves a
"view in desktop app or browser?" interstitial on a browser's FIRST visit to ANY route
(including /login — proven by shot-proof2-mattermost-lts: byte-identical interstitial PNG with
and without a plain /login hook); a real user clicks "View in Browser" to reach the login
form, so the hook does exactly that. Click + second settle are best-effort (if the
interstitial is absent we are already on the form). Credential-free (empty fields, R7
secret-safety); the harness snaps the PNG after this returns. Waits are kept short (8s/3s/8s)
so the realistic hook path stays well inside the ~60s step budget — the 45s nav deadline is
only burned when the app never serves, and then the hook raises before any settle."""
import contextlib
from harness import browser as harness_browser
from harness import screenshot as screenshot_mod
harness_browser.goto_with_retry(
page,
f"{ctx.base_url}/login",
accept_statuses=(200,),
deadline_seconds=screenshot_mod.NAV_DEADLINE_S,
wait_until="domcontentloaded",
)
screenshot_mod.settle(page, 8_000)
with contextlib.suppress(Exception):
page.click("text=View in Browser", timeout=3_000)
screenshot_mod.settle(page, 8_000)