#!/usr/bin/env bash # DEP-001 起步:test 环境容器 smoke(ready / health / SPA 首页 / 静态资源) set -euo pipefail BASE_URL="${1:-http://127.0.0.1:8081}" PI_AGENT_URL="${2:-http://127.0.0.1:18866}" fail=0 check() { local name="$1" shift if "$@"; then echo "[PASS] ${name}" else echo "[FAIL] ${name}" >&2 fail=1 fi } check "test app /api/v1/ready" curl -fsS "${BASE_URL}/api/v1/ready" >/dev/null check "test app /api/v1/health" curl -fsS "${BASE_URL}/api/v1/health" >/dev/null check "test app SPA /" bash -c "curl -fsS '${BASE_URL}/' | grep -q 'id=\"root\"'" check "test app deep link /projects" bash -c "code=\$(curl -fsS -o /dev/null -w '%{http_code}' '${BASE_URL}/projects'); [[ \"\${code}\" == '200' || \"\${code}\" == '404' ]]" check "pi-agent /health" bash -c "curl -fsS '${PI_AGENT_URL}/health' | grep -q '\"ok\": true'" if (( fail > 0 )); then exit 1 fi echo "[SUCCESS] test env smoke passed"