commit 97f8fcd6fa58e150df0351eb09f28e7986195d76
parent 8069c51effa2b3b4aa8ef21b6f827803c09b2936
Author: finwo <finwo@pm.me>
Date: Mon, 21 Sep 2026 14:49:28 +0200
More consistent dynamic ip during smoke test
Diffstat:
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/deploy/smoke.sh b/deploy/smoke.sh
@@ -122,9 +122,14 @@ compose() { SMOKE_TOKEN="${SMOKE_TOKEN:-unused}" docker compose -p "${PROJECT}"
log "starting the conductor"
compose up -d conductor
+# All curl requests go through port publishing. The container IP is not
+# reachable because the smoke test runs in its own network namespace.
+BASE_URL="http://${SMOKE_HOST}:${PORT}"
+printf 'using %s\n' "${BASE_URL}"
+
i=0
while [ "${i}" -lt 60 ]; do
- curl -fsS -m 2 "http://${SMOKE_HOST}:${PORT}/health" >/dev/null 2>&1 && break
+ curl -fsS -m 2 "${BASE_URL}/health" >/dev/null 2>&1 && break
i=$((i + 1))
sleep 1
done
@@ -132,18 +137,9 @@ if [ "${i}" -ge 60 ]; then
compose logs conductor | tail -40
fail "the conductor did not become healthy"
fi
-curl -fsS "http://${SMOKE_HOST}:${PORT}/health"
+curl -fsS "${BASE_URL}/health"
printf '\n'
-# Use the container's internal IP for reliable access. Port publishing from
-# one container to another is unreliable (127.0.0.1 refers to the caller,
-# and gateway IPs vary by host). The container IP is always reachable via
-# the Docker bridge network.
-CONTAINER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "${PROJECT}-conductor-1")
-[ -n "${CONTAINER_IP}" ] || fail "could not determine conductor container IP"
-BASE_URL="http://${CONTAINER_IP}:9080"
-printf 'using %s\n' "${BASE_URL}"
-
log "registering the project and a worker"
compose exec -T conductor node src/admin-cli.js project:add demo /repo --secret "${SECRET}" >/dev/null
SMOKE_TOKEN=$(compose exec -T conductor node src/admin-cli.js token:add smoke-worker | awk '/token:/{print $2}')
@@ -171,6 +167,16 @@ job_state() {
| sed -n 's/.*class="badge \([a-z]*\)".*/\1/p' | head -1
}
+# Verify /jobs is reachable before the main loop; if it's not, dump
+# diagnostic info rather than spinning silently for 90 seconds.
+sleep 1
+HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' "${BASE_URL}/jobs/${JOB}")
+if [ "${HTTP_CODE}" != "200" ]; then
+ printf '/jobs/%s returned %s (expected 200)\n' "${JOB}" "${HTTP_CODE}" >&2
+ curl -s "${BASE_URL}/jobs/" | head -20 >&2
+ compose logs conductor | tail -20 >&2
+fi
+
log "waiting for the job to finish"
STATE_NOW=
i=0