Files
recipe-maintainer/recipe-info/lichen/tests/health_check.py
T
autonomic-bot f283a371bb recipe-maintainer: public snapshot (secrets + deployment plans removed, single commit)
Sanitized single-commit public mirror of recipe-maintainer.
- Removed test-ssh/.testenv (live creds); added test-ssh/.testenv.example placeholders.
- Removed plans/ and planned-updates/ (deployment-planning docs) so no client/
  deployment domains appear in the public repo.
- All other secret stores were already gitignored.
- docs.coopcloud.tech retained as a submodule (public upstream).
2026-06-16 20:18:24 +00:00

52 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""Basic health check for Lichen — verifies the dashboard and API are up."""
import argparse
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
from utils.tests.helpers import http_get, resolve_domain
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--domain', default=os.environ.get('TEST_DOMAIN'))
args = parser.parse_args()
domain = args.domain or resolve_domain('lichen')
url = f"https://{domain}"
print("Lichen health check")
print()
# Step 1: TLS check endpoint
print("Step 1: Checking /tls-check endpoint ...")
status, _ = http_get(f"{url}/tls-check")
if status != 200:
print(f" FAIL: /tls-check returned HTTP {status}")
sys.exit(1)
print(f" PASS: /tls-check returned HTTP {status}")
# Step 2: Dashboard redirects to login (auth enabled)
print("Step 2: Checking dashboard redirects to login ...")
status, _ = http_get(url)
if status not in (200, 303, 302):
print(f" FAIL: Dashboard returned HTTP {status}")
sys.exit(1)
print(f" PASS: Dashboard returned HTTP {status}")
# Step 3: API endpoint
print("Step 3: Checking /api/sites endpoint ...")
status, _ = http_get(f"{url}/api/sites")
if status == 0 or status >= 500:
print(f" FAIL: API returned HTTP {status}")
sys.exit(1)
print(f" PASS: API returned HTTP {status}")
print()
print("PASS: Lichen health check passed")
if __name__ == '__main__':
main()