[control] The admin host is accepted with any port (Docker or a router may publish 443 elsewhere); smoke scripts: Windows-readable paths, curl without Schannel's revocation check, logs on failure
This commit is contained in:
@@ -15,7 +15,7 @@ set -euo pipefail
|
||||
export MSYS_NO_PATHCONV=1 MSYS2_ENV_CONV_EXCL='*'
|
||||
|
||||
IMAGE=$1 CTL=$2 WORK=$3
|
||||
REPO=$(cd "$(dirname "$0")/.." && pwd)
|
||||
REPO=$(cd "$(dirname "$0")/.." && (pwd -W 2>/dev/null || pwd))
|
||||
P=ianitor-smoke
|
||||
export COMPOSE_PROJECT_NAME=$P IANITOR_IMAGE=$IMAGE IANITOR_HTTP_PORT=28080 IANITOR_HTTPS_PORT=28443
|
||||
export IANITOR_ADMIN_HOST=ianitor.smoke.test IANITOR_TLS=domi IANITOR_DOMI_ROOT=/var/lib/ianitor/domi-root.crt
|
||||
@@ -23,7 +23,7 @@ export IANITOR_PREVIEW_DOMAIN=pv.smoke.test IANITOR_PREVIEW_UPSTREAMS=app:8080
|
||||
DC=(docker compose -f "$REPO/deploy/docker/compose.yaml")
|
||||
step() { echo "== $*"; }
|
||||
ok() { echo " ok: $*"; }
|
||||
fail() { echo "FAILED: $*" >&2; exit 1; }
|
||||
fail() { echo "FAILED: $*" >&2; "${DC[@]}" logs --tail 40 control edge >&2 2>&1 || true; exit 1; }
|
||||
cleanup() {
|
||||
"${DC[@]}" down -v --remove-orphans >/dev/null 2>&1 || true
|
||||
docker rm -f $P-app >/dev/null 2>&1 || true
|
||||
@@ -32,6 +32,8 @@ cleanup() {
|
||||
trap cleanup EXIT
|
||||
[ ! -e "$WORK" ] || fail "$WORK exists; give a new folder"
|
||||
mkdir -p "$WORK"
|
||||
# A drive path (F:/…) on Windows, which both Git Bash and the Windows ianitor-control read.
|
||||
WORK=$(cd "$WORK" && (pwd -W 2>/dev/null || pwd))
|
||||
# In edge's network namespace: the loopback API (curl and jq from a throw-away Alpine).
|
||||
inside() { docker run --rm -i --network container:$P-edge-1 alpine:3.20 sh -c "apk add -q curl jq >/dev/null && $1"; }
|
||||
|
||||
@@ -43,7 +45,7 @@ docker run --rm -i -v ${P}_state:/v alpine:3.20 sh -c 'cat > /v/domi-root.crt &&
|
||||
ok "root in the state volume"
|
||||
|
||||
step "docker compose up"
|
||||
"${DC[@]}" up -d >/dev/null 2>&1 || fail "compose up"
|
||||
"${DC[@]}" up -d > "$WORK/compose-up.log" 2>&1 || { cat "$WORK/compose-up.log"; fail "compose up"; }
|
||||
for i in $(seq 60); do inside "curl -s -o /dev/null http://127.0.0.1:7878/" 2>/dev/null && break; sleep 2; done
|
||||
ADMIN=$("${DC[@]}" exec -T control ianitor-control token create --name smoke --config /var/lib/ianitor/control.toml 2>/dev/null | tail -n1)
|
||||
FABRICA=$("${DC[@]}" exec -T control ianitor-control token create --name fabrica --scope previews --config /var/lib/ianitor/control.toml 2>/dev/null | tail -n1)
|
||||
@@ -71,10 +73,10 @@ step "Fabrica opens the preview (scripts/preview.sh, previews-only token)"
|
||||
url=$(inside "IANITOR_URL=http://127.0.0.1:7878 IANITOR_PREVIEW_TOKEN=$FABRICA sh -s -- open shop fix-42 http://app:8080 3600" < "$REPO/scripts/preview.sh")
|
||||
[ "$url" = "https://fix-42--shop.pv.smoke.test/" ] || fail "preview URL: $url"
|
||||
ok "preview URL $url"
|
||||
body=$(curl -sS --cacert "$WORK/root/domi-root.crt" --resolve fix-42--shop.pv.smoke.test:28443:127.0.0.1 https://fix-42--shop.pv.smoke.test:28443/ || true)
|
||||
body=$(curl -sS --ssl-no-revoke --cacert "$WORK/root/domi-root.crt" --resolve fix-42--shop.pv.smoke.test:28443:127.0.0.1 https://fix-42--shop.pv.smoke.test:28443/ || true)
|
||||
[ "$body" = "hello from fix-42" ] || fail "the preview through edge: $body"
|
||||
ok "the preview answers through edge (Pingora) from the host, with a Domi certificate"
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' --cacert "$WORK/root/domi-root.crt" --resolve ianitor.smoke.test:28443:127.0.0.1 https://ianitor.smoke.test:28443/api/v1/team || true)
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' --ssl-no-revoke --cacert "$WORK/root/domi-root.crt" --resolve ianitor.smoke.test:28443:127.0.0.1 https://ianitor.smoke.test:28443/api/v1/team || true)
|
||||
[ "$code" = 401 ] || fail "admin host: $code"
|
||||
ok "the admin host reaches control and needs a sign-in (401)"
|
||||
code=$(inside "curl -s -o /dev/null -w '%{http_code}' -H 'Authorization: Bearer $FABRICA' http://127.0.0.1:7878/api/v1/hosts")
|
||||
@@ -84,7 +86,7 @@ ok "the preview token cannot read the hosts (403)"
|
||||
step "closed on merge"
|
||||
inside "IANITOR_URL=http://127.0.0.1:7878 IANITOR_PREVIEW_TOKEN=$FABRICA sh -s -- close shop fix-42" < "$REPO/scripts/preview.sh" >/dev/null
|
||||
for i in $(seq 45); do
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' --cacert "$WORK/root/domi-root.crt" --resolve fix-42--shop.pv.smoke.test:28443:127.0.0.1 https://fix-42--shop.pv.smoke.test:28443/ || true)
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' --ssl-no-revoke --cacert "$WORK/root/domi-root.crt" --resolve fix-42--shop.pv.smoke.test:28443:127.0.0.1 https://fix-42--shop.pv.smoke.test:28443/ || true)
|
||||
[ "$code" != 200 ] && break
|
||||
sleep 2
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user