"""matrix-synapse — health-check parity port (Phase 2 P2). SOURCE: there is no `recipe-info/matrix-synapse/tests/health_check.py` in the recipe-maintainer corpus (the corpus's matrix-synapse tests are shell scripts targeting a persistent instance — see DECISIONS.md for the Q4 deeper-port deferral). This file is a Phase-2 health_check ALIGNED with the parity-port convention: HTTP 200 from the client API versions endpoint, which is the recipe's HEALTH_PATH and the canonical "is synapse up" signal. Runs in the custom tier against the shared post-install live deployment. """ from __future__ import annotations import json 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_synapse_client_versions_returns_json(live_app): """Verify /_matrix/client/versions returns 200 + a JSON document with a non-empty versions list.""" url = f"https://{live_app}/_matrix/client/versions" status, body = harness_http.retry_http_get(url, expect_status=200, max_wait=60, interval=3) assert status == 200, f"GET {url} HTTP {status} (expected 200)" assert isinstance(body, dict) and isinstance(body.get("versions"), list) and body["versions"], ( f"GET {url} did not return Matrix client-versions document: {body!r}" )