Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
36 lines
1.6 KiB
Bash
Executable File
36 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# Smoke check for the local stack: exits non-zero and names the failing call if any step fails.
|
|
set -u
|
|
GW=http://localhost:8081
|
|
MOBILE=http://localhost:8080
|
|
GW_KEY=colite-local-gateway-key-000000000000
|
|
APP_KEY=colite-local-app-key
|
|
|
|
fail() { echo "FAIL: $1"; exit 1; }
|
|
|
|
# 1. Admin login: mobile-api -> service-auth -> service-system -> MySQL
|
|
token=$(curl -sf -X POST "$MOBILE/api/admin/auth/login" -H "api-key: $APP_KEY" -H 'Content-Type: application/json' \
|
|
-d '{"username":"admin","password":"colite-dev-admin"}' \
|
|
| sed -n 's/.*"token":"\([^"]*\)".*/\1/p') || fail "POST $MOBILE/api/admin/auth/login"
|
|
[ -n "$token" ] || fail "POST $MOBILE/api/admin/auth/login returned no token"
|
|
echo "api/admin/auth/login: 200"
|
|
|
|
# 2. Admin guard and session lookup, then the users list (service-system)
|
|
for path in /api/admin/me /api/admin/users; do
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' "$MOBILE$path" -H "api-key: $APP_KEY" -H "Authorization: Bearer $token")
|
|
[ "$code" = 200 ] || fail "GET $MOBILE$path returned $code"
|
|
echo "${path#/}: $code"
|
|
done
|
|
|
|
# 3. gateway -> service-counter -> MySQL
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' "$GW/counter/event/findCurrentEvent" \
|
|
-H "api-key: $GW_KEY" -H "Authorization: Bearer $token")
|
|
[ "$code" = 200 ] || fail "GET $GW/counter/event/findCurrentEvent returned $code"
|
|
echo "counter/event/findCurrentEvent: $code"
|
|
|
|
# 4. mobile-api -> gateway -> service-system -> MySQL, no login
|
|
code=$(curl -s -o /dev/null -w '%{http_code}' "$MOBILE/api/public/messages/en_US" -H "api-key: $APP_KEY")
|
|
[ "$code" = 200 ] || fail "GET $MOBILE/api/public/messages/en_US returned $code"
|
|
echo "api/public/messages/en_US: $code"
|
|
echo "smoke: OK"
|