Files
cc-ci/tests/custom-html/functional/test_health_check.py
autonomic-bot bec92659b1 feat(2): Q0.3/Q1.1 — custom-html PARITY + functional + playwright (Phase 2)
- tests/custom-html/PARITY.md: parity mapping (health_check.py ported);
  recipe-specific tests recorded with rationale; backup data-integrity +
  playwright sections.
- tests/custom-html/functional/test_health_check.py: parity port of
  recipe-info/custom-html/tests/health_check.py — SOURCE comment included.
- tests/custom-html/functional/test_content_roundtrip.py: NEW recipe-specific —
  write a marker into the served volume, fetch over HTTPS, assert exact bytes.
- tests/custom-html/functional/test_content_type_header.py: NEW recipe-specific —
  prove nginx returns text/html for .html and text/plain for .txt (MIME mapping).
- tests/custom-html/playwright/test_browser_smoke.py: P6 browser smoke (renders
  HTML, no console errors). Standalone Phase-2 custom-stage version.

Verified cold on cc-ci (STAGES=install,custom): 5 assertions all PASS in one
run (install generic + install overlay + content roundtrip + content type +
health check + browser smoke), deploy-count=1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 04:40:12 +01:00

29 lines
1.3 KiB
Python

"""custom-html — parity port of recipe-maintainer's health_check.py (Phase 2 P2).
SOURCE: references/recipe-maintainer/recipe-info/custom-html/tests/health_check.py
The recipe-maintainer original asserted `HTTP 200` from `https://custom-html.<DOMAIN_SUFFIX>`. The
cc-ci port preserves that assertion shape (the served response is a real, non-error HTTP) but adapts
to the ephemeral per-run domain via the `live_app` fixture from `tests/conftest.py`. It runs in the
**custom** tier against the shared post-install live deployment — no deploy/teardown here.
"""
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_custom_html_returns_200(live_app):
"""Parity with recipe-info/custom-html/tests/health_check.py: HTTP 200 from the app root.
Uses harness.http.retry_http_get so the cc-ci test is tolerant of any brief reconverge after the
deploy (the orchestrator already waited for services_converged + ok status, so this should be
immediate; the short retry is a safety net only)."""
url = f"https://{live_app}/"
status, _ = harness_http.retry_http_get(url, expect_status=200, max_wait=30, interval=2)
assert status == 200, f"custom-html at {url} returned HTTP {status} (expected 200)"