Rebuild & Deploy / rebuild (push) Successful in 1m0s
The Unraid deployment's /media/api requests were answered by an Apache/YOURLS stack squatting on 8092, surfacing as UI 503s; the CI healthcheck (curl without -f) counted that 503 as healthy, so run #15 deployed green against a broken media server. - media server port 8092 -> 8093 everywhere (server, MCP, agent, nginx, compose, CI, .env.example, docs, tests). - healthchecks use curl -f in compose and rebuild.yml so HTTP error statuses fail deployment. - tests default to the Unraid deployment (VOICE_WEB_URL= https://192.168.86.2:9178); token goes through nginx (loopback :8091 is unreachable off-host); bind-mount-coupled tests skip on remote targets. AGENTS.md documents the convention and both failure modes.
84 lines
2.6 KiB
Python
84 lines
2.6 KiB
Python
"""Tests for the web UI served by nginx (HTTPS :9178) and the token endpoint."""
|
|
|
|
import json
|
|
|
|
import httpx
|
|
|
|
|
|
def test_index_serves(client):
|
|
resp = client.get("/")
|
|
assert resp.status_code == 200
|
|
body = resp.text
|
|
assert "Hope" in body
|
|
assert "livekit-client.umd.js" in body
|
|
assert "app.js" in body
|
|
assert 'id="voiceModeBtn"' in body
|
|
assert 'id="textModeBtn"' in body
|
|
assert 'id="chatComposer"' in body
|
|
|
|
|
|
def test_app_js_serves(client):
|
|
resp = client.get("/app.js")
|
|
assert resp.status_code == 200
|
|
assert "LiveKitClient" in resp.text or "Room" in resp.text
|
|
assert 'topic: "lk.chat"' in resp.text
|
|
assert "sendModeMessage" in resp.text
|
|
|
|
|
|
def test_style_css_serves(client):
|
|
resp = client.get("/style.css")
|
|
assert resp.status_code == 200
|
|
body = resp.text
|
|
assert "{" in body and "}" in body
|
|
assert "color" in body or "background" in body
|
|
|
|
|
|
def test_manifest_serves(client):
|
|
resp = client.get("/manifest.json")
|
|
assert resp.status_code == 200
|
|
manifest = json.loads(resp.text)
|
|
assert "name" in manifest
|
|
|
|
|
|
def test_favicon_serves(client):
|
|
resp = client.get("/favicon.svg")
|
|
assert resp.status_code == 200
|
|
assert "svg" in resp.headers.get("content-type", "")
|
|
assert "<svg" in resp.text
|
|
|
|
|
|
def test_livekit_client_bundle_serves(client):
|
|
resp = client.get("/livekit-client.umd.js")
|
|
assert resp.status_code == 200
|
|
assert len(resp.text) > 100_000 # vendored UMD bundle is large
|
|
|
|
|
|
def test_token_endpoint_direct():
|
|
"""Token endpoint via TOKEN_URL (nginx path on remote deployments,
|
|
loopback :8091 when VOICE_TOKEN_URL points at the deployment host)."""
|
|
import conftest
|
|
|
|
resp = httpx.post(conftest.TOKEN_URL, json={}, timeout=10, verify=False)
|
|
assert resp.status_code == 200
|
|
data = resp.json()
|
|
assert "token" in data and data["token"].count(".") == 2 # JWT shape
|
|
assert data["user"]["id"] == "shane"
|
|
|
|
|
|
def test_token_endpoint_via_nginx(client):
|
|
"""nginx proxies /token to the token server."""
|
|
resp = client.post("/token", json={})
|
|
assert resp.status_code == 200
|
|
data = resp.json()
|
|
assert "token" in data and data["token"].count(".") == 2
|
|
|
|
|
|
def test_livekit_ws_proxy(client):
|
|
"""The /livekit/ path is proxied to the LiveKit server (HTTP :7880)."""
|
|
resp = client.get("/livekit/")
|
|
# LiveKit's HTTP API answers on /; a 200 or an API error JSON both prove
|
|
# the proxy reaches the LiveKit server rather than nginx serving statics.
|
|
assert resp.status_code in (200, 404, 405)
|
|
if resp.headers.get("content-type", "").startswith("application/json"):
|
|
json.loads(resp.text)
|