"""discourse — health/readiness functional test (Phase 2).

SOURCE: no recipe-maintainer corpus exists for discourse (P2 vacuous — see PARITY.md). This is a
Phase-2 health check aligned with the parity-port convention: /srv/status returns 200 only once the
Rails app is actually serving (the recipe's HEALTH_PATH and the canonical "is discourse up" signal).
"""

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_discourse_srv_status_ok(live_app):
    url = f"https://{live_app}/srv/status"
    status, _ = harness_http.retry_http_get(url, expect_status=200, max_wait=120, interval=5)
    assert status == 200, f"GET {url} HTTP {status} (expected 200 — discourse not serving)"
