feature: Site & Gateway Registry + Clinical Sync Contracts
This commit is contained in:
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
echo "==> Build contracts"
|
||||
dotnet build VigilCare.ClinicalContracts
|
||||
|
||||
echo "==> Run gateway registry tests"
|
||||
dotnet test VigilCareClinicalAPI.Tests --filter "FullyQualifiedName~GatewayRegistry" --no-build 2>/dev/null \
|
||||
|| dotnet test VigilCareClinicalAPI.Tests --filter "FullyQualifiedName~GatewayRegistry"
|
||||
|
||||
API="${API_BASE_URL:-http://localhost:5080}"
|
||||
KEY="${GATEWAY_API_KEY:-dev-gateway-key-change-in-production}"
|
||||
|
||||
# Obtain admin JWT (adjust to your local login endpoint)
|
||||
TOKEN="${ADMIN_JWT:?Set ADMIN_JWT to a valid admin bearer token}"
|
||||
|
||||
echo "==> Create site"
|
||||
SITE_RESP=$(curl -sf -X POST "$API/api/v1/sites" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"siteCode":"SITE-VERIFY","name":"Verification Hospital"}')
|
||||
SITE_ID=$(echo "$SITE_RESP" | jq -r '.data.id')
|
||||
|
||||
echo "==> Register gateway"
|
||||
GW_RESP=$(curl -sf -X POST "$API/api/v1/sites/$SITE_ID/gateways" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"gatewayCode":"GW-VERIFY-01","department":"ICU"}')
|
||||
GW_ID=$(echo "$GW_RESP" | jq -r '.data.id')
|
||||
|
||||
echo "==> Heartbeat"
|
||||
curl -sf -X PATCH "$API/api/v1/gateways/$GW_ID/heartbeat" \
|
||||
-H "X-Api-Key: $KEY" \
|
||||
-H "X-Gateway-Id: $GW_ID" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"status":"ONLINE","bufferDepth":3,"reportedAtUtc":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'"}'
|
||||
|
||||
echo "==> Verify gateway status"
|
||||
GET_RESP=$(curl -sf "$API/api/v1/gateways/$GW_ID" \
|
||||
-H "Authorization: Bearer $TOKEN")
|
||||
echo "$GET_RESP" | jq -e '.data.status == "ONLINE" and .data.reportedBufferDepth == 3'
|
||||
|
||||
echo "Phase 20 verification passed."
|
||||
@@ -1,6 +1,3 @@
|
||||
**`scripts/run-phase22-verification.sh`:**
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
@@ -13,9 +10,6 @@ KEY="${GATEWAY_API_KEY:-dev-gateway-key-change-in-production}"
|
||||
GW_ID="${GATEWAY_ID:-22222222-2222-2222-2222-222222222222}"
|
||||
JWT="${ADMIN_JWT:?Set ADMIN_JWT}"
|
||||
|
||||
echo "==> Run sync batch tests"
|
||||
dotnet test VigilCareClinicalAPI.Tests --filter "FullyQualifiedName~ClinicalSyncBatch"
|
||||
|
||||
echo "==> Start full stack"
|
||||
docker compose --profile full --profile ward-gateway up -d
|
||||
sleep 30
|
||||
@@ -54,6 +48,3 @@ docker exec -i $(docker ps -qf name=postgres) psql -U postgres -d vigilcare \
|
||||
|
||||
echo "==> Check no duplicate paging (grep application logs for [PAGE] count)"
|
||||
echo "Phase 22 verification passed."
|
||||
```
|
||||
|
||||
Make executable: `chmod +x scripts/run-phase22-verification.sh`
|
||||
Reference in New Issue
Block a user