Files
cc-ci/tests/matrix-synapse/functional/test_health_check.py
autonomic-bot 9a7772563a style: repo-wide lint pass — make the lint gate green again
Push builds have been RED on the lint step since ~build 209 from accumulated
formatting drift. This is the mechanical cleanup: ruff format + ruff --fix
(UP038 isinstance unions, SIM105 contextlib.suppress, UP031 f-strings, SIM115
tempfile context manager), shfmt -i 2 -ci, nixpkgs-fmt/statix/deadnix (merged
attrsets, dropped unused lib args), yamllint, and shell quoting fixes in
tests/lasuite-docs/setup_custom_tests.sh. No behaviour changes intended;
lint: PASS, unit tests: 138 passed.
2026-06-09 21:56:15 +00:00

29 lines
1.3 KiB
Python

"""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 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}"