30 lines
953 B
Python
30 lines
953 B
Python
"""Read-only HTTP smoke checks. No frame writes; token read from env/private .env."""
|
|||
|
|
|
||
|
|
import os
|
||
|
|
from pathlib import Path
|
||
|
|
from urllib.request import Request, urlopen
|
||
|
|
|
||
|
|
base = os.getenv("FRAME_FLOW_URL", "http://127.0.0.1:18787").rstrip("/")
|
||
|
|
token = os.getenv("FRAME_FLOW_TOKEN", "")
|
||
|
|
if not token and Path(".env").exists():
|
||
|
|
for line in Path(".env").read_text().splitlines():
|
||
|
|
if line.startswith("FRAME_FLOW_TOKEN="):
|
||
|
|
token = line.split("=", 1)[1]
|
||
|
|
for path in [
|
||
|
|
"/health",
|
||
|
|
"/ready",
|
||
|
|
"/api/v1/version",
|
||
|
|
"/openapi.json",
|
||
|
|
"/docs",
|
||
|
|
"/",
|
||
|
|
"/api/v1/devices",
|
||
|
|
"/api/v1/templates",
|
||
|
|
"/api/v1/jobs",
|
||
|
|
]:
|
||
|
|
request = Request(base + path, headers={"Authorization": "Bearer " + token})
|
||
|
|
with urlopen(request, timeout=15) as response:
|
||
|
|
body = response.read()
|
||
|
|
print(path, "HTTP", response.status, "bytes", len(body))
|
||
|
|
assert response.status == 200
|
||
|
|
print("Read-only smoke checks passed")
|