#!/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: gateway -> service-auth -> service-system -> MySQL token=$(curl -sf -X POST "$GW/auth/authenticate" -H "api-key: $GW_KEY" -H 'Content-Type: application/json' \ -d '{"username":"admin","password":"colite-dev-admin"}') || fail "POST $GW/auth/authenticate" [ -n "$token" ] || fail "POST $GW/auth/authenticate returned no token" echo "auth/authenticate: 200" # 2. 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" # 3. mobile-api -> gateway -> service-system -> MySQL 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"