Files
ruoyi-vue-pro/tools/education-target-smoke/java-read-readiness.sh

26 lines
936 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
BASE_URL="${BASE_URL:-http://127.0.0.1:48080}"
TOKEN="${EDUCATION_ADMIN_TOKEN:?EDUCATION_ADMIN_TOKEN is required}"
TENANT_ID="${EDUCATION_TENANT_ID:?EDUCATION_TENANT_ID is required}"
response="$(curl --fail --silent --show-error \
-H "Authorization: Bearer ${TOKEN}" \
-H "tenant-id: ${TENANT_ID}" \
"${BASE_URL}/admin-api/education/operations/health")"
python3 - "$response" <<'PY'
import json, sys
body = json.loads(sys.argv[1])
assert body.get("code") == 0, body
health = body["data"]
deps = {item["key"]: item for item in health["dependencies"]}
java = deps.get("java-read-postgresql")
scalar = deps.get("scalar-catalog")
assert java and java["required"] and java["status"] == "UP", deps
assert scalar and not scalar["required"] and scalar["status"] == "NOT_SELECTED", deps
assert health["status"] in ("UP", "DEGRADED"), health
print("target-only JAVA_READ readiness proof passed")
PY