Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(scripts): report a failed call in the docker-proxy smoke test

Yudhi Armyndharis7f55e6283e6a
diff --git a/scripts/smoke-test-docker-proxy.sh b/scripts/smoke-test-docker-proxy.sh
index ff60deeff..3ae428cbd 100755
--- a/scripts/smoke-test-docker-proxy.sh
+++ b/scripts/smoke-test-docker-proxy.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Smoke test: verify openwa-api can list containers via docker-socket-proxy.
# Run this after `docker compose up -d` with the stack fully started.
-# Usage: ./scripts/smoke-test-docker-proxy.sh [API_KEY]
+# Usage: ./scripts/smoke-test-docker-proxy.sh <admin-api-key>
set -e
API_KEY="${1:-}"
@@ -13,7 +13,8 @@ if [ -z "$API_KEY" ]; then
fi
echo "==> Checking openwa-api health..."
-STATUS=$(curl -sf -o /dev/null -w "%{http_code}" "$BASE_URL/api/health")
+# No -f on these calls: under set -e a failing status would end the script before the check says why.
+STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$BASE_URL/api/health" || true)
if [ "$STATUS" != "200" ]; then
echo "FAIL: /api/health returned HTTP $STATUS (expected 200)" >&2
exit 1
@@ -21,16 +22,19 @@ fi
echo "PASS: API health OK"
echo ""
-echo "==> Verifying Docker proxy connectivity via infrastructure status..."
-RESPONSE=$(curl -sf \
+echo "==> Checking the admin API answers (infrastructure status)..."
+RESPONSE=$(curl -s -w '\n%{http_code}' \
-H "X-API-Key: $API_KEY" \
- "$BASE_URL/api/infra/status")
-
-echo "Response: $RESPONSE"
+ "$BASE_URL/api/infra/status" || true)
+CODE=$(printf '%s\n' "$RESPONSE" | tail -n 1)
+if [ "$CODE" != "200" ]; then
+ echo "FAIL: /api/infra/status returned HTTP $CODE (expected 200; the key must be an ADMIN key)" >&2
+ exit 1
+fi
+echo "Response: $(printf '%s\n' "$RESPONSE" | sed '$d')"
-# The key check: docker availability flag from DockerService.isDockerAvailable()
-# If the proxy is unreachable, the service logs a warning and sets isAvailable=false.
-# We indirectly validate this by confirming the API responds without error.
+# This proves only that the admin API answers: the status payload carries no Docker flag. Whether
+# the proxy admits what orchestration needs is checked from inside openwa-api below.
echo ""
echo "==> Verifying docker-proxy container is running..."
PROXY_STATE=$(docker inspect --format='{{.State.Status}}' openwa-docker-proxy 2>/dev/null || echo "not_found")