fix: smoke tests use localhost:8080 (port mapping creates ambiguous container IPs)

This commit is contained in:
Oskar Kapala 2026-06-02 21:49:52 +02:00
parent 9e591d92cd
commit 3f5dd536d1

View file

@ -33,27 +33,29 @@ cd "$DEPLOY_DIR"
git pull origin main
docker compose up -d --build --remove-orphans
# ── 3. Smoke test ─────────────────────────────────────────────────────────
# ── 3. Smoke test via host port 8080 ──────────────────────────────────────
# Host: ubuntu-4gb-hel1-1
# Port mapping adds a second network to the container, making the IP list
# ambiguous — use localhost:8080 (published port) for all checks instead.
echo "Waiting for container to be ready..."
sleep 2
CONTAINER_IP=$(docker inspect humanai-landing \
--format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')
BASE="http://localhost:8080"
smoke_check() {
local path="$1"
local expect="$2"
local url="http://${CONTAINER_IP}${path}"
local body
body=$(curl -sf --max-time 5 "$url") || {
body=$(curl -sf --max-time 5 "${BASE}${path}") || {
echo "FAIL GET ${path} — no response (curl exit $?)"
docker compose logs --tail=40
return 1
}
if echo "$body" | grep -qF "$expect"; then
echo "OK GET ${path} — found: ${expect}"
else
echo "FAIL GET ${path} — '${expect}' not in response"
docker compose logs --tail=40
return 1
fi
}
@ -64,9 +66,7 @@ smoke_check "/" "hreflang"
smoke_check "/" "mailto:oskar@gethumanai.com"
smoke_check "/en/" "human review"
# ── 4. Host-port smoke test ───────────────────────────────────────────────
# Host: ubuntu-4gb-hel1-1
echo "Checking host port 8080..."
echo "Checking headers on localhost:8080..."
if curl -fsS -I --max-time 5 http://localhost:8080; then
echo "OK localhost:8080 — 200"
else