test(observability): include health in smoke suite
All checks were successful
CD Pipeline / deploy (push) Successful in 4m4s

This commit is contained in:
OoO
2026-05-05 23:20:45 +08:00
parent cdcbcf1d80
commit be1d1aec03
2 changed files with 28 additions and 0 deletions

View File

@@ -17,6 +17,12 @@ from observability_contract import CSS_ASSET_CHECKS, OBSERVABILITY_PAGES
MIN_HTML_BYTES = 2500
HEALTH_CHECK = (
"/health",
"App Health",
("healthy",),
)
GLOBAL_REQUIRED_MARKERS = [
"momo-observability-mode",
"observability-system.css",
@@ -54,6 +60,27 @@ def main() -> int:
failed = False
print(f"Observability page smoke: {args.base_url.rstrip('/')}")
health_path, health_label, health_markers = HEALTH_CHECK
try:
status, body = fetch_page(args.base_url, health_path, args.timeout)
missing_markers = [marker for marker in health_markers if marker not in body]
if status != 200 or missing_markers:
issues = []
if status != 200:
issues.append("bad_status")
if missing_markers:
issues.append(f"missing_health_markers={missing_markers}")
print(f"- {health_label}: HTTP {status}, issues={issues}, FAIL")
failed = True
else:
print(f"- {health_label}: HTTP {status}, markers=ok")
except urllib.error.HTTPError as exc:
print(f"- {health_label}: HTTP {exc.code}, FAIL")
failed = True
except Exception as exc:
print(f"- {health_label}: {type(exc).__name__}: {exc}, FAIL")
failed = True
for page in OBSERVABILITY_PAGES:
try:
status, html = fetch_page(args.base_url, page.url, args.timeout)