fix: serialize delegations and repair verification

This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 99fa5de747
commit 5f17aab6ca
8 files changed
+99 -43

No files matched your search

+10 -10
View File
@@ -13,7 +13,7 @@ version=$2
commit=$3
probe=${PROBE_IMAGE:-golang:1.27-alpine}
mysql_image=${MYSQL_IMAGE:-mysql:8.4}
name="cdwu-img-${IMG_ID:-$$}"
name="${IMG_NAME:-cdwu-img-${IMG_ID:-$$}}"
network="$name"
mysql="${name}-mysql"
server="${name}-app"
@@ -34,7 +34,7 @@ cleanup() {
fi
done
fi
docker rm --force --volumes "$server" "$mysql" "$exported" >/dev/null 2>&1 || true
docker rm --force --volumes "$server" "$mysql" "$exported" "${name}-probe" >/dev/null 2>&1 || true
docker network rm "$network" >/dev/null 2>&1 || true
rm -rf "$tmp"
exit "$status"
@@ -113,7 +113,7 @@ ok "OCI labels"
[ "$(docker image inspect --format '{{json .Config.Healthcheck.Test}}' "$image")" = '["CMD","/app","healthcheck"]' ] || fail "image healthcheck is not /app healthcheck"
ok "image user, entrypoint and healthcheck"
capture docker run --rm --entrypoint /bin/sh "$image" -c true
capture docker run --rm --name "${name}-probe" --entrypoint /bin/sh "$image" -c true
[ "$rc" -ne 0 ] || fail "the image runs /bin/sh"
docker create --name "$exported" "$image" >/dev/null
docker export "$exported" | tar -t >"$tmp/files"
@@ -129,23 +129,23 @@ grep -qx 'app' "$tmp/files" || fail "/app missing from the image filesystem"
grep -qx 'etc/ssl/cert.pem' "$tmp/files" || fail "CA bundle missing from the image filesystem"
ok "image filesystem has no shell"
capture docker run --rm "$image"
capture docker run --rm --name "${name}-probe" "$image"
expect_rc "start without configuration" 2
ok "exit 2 without configuration"
capture docker run --rm "$image" version
capture docker run --rm --name "${name}-probe" "$image" version
expect_rc "version" 0
[ "$(cat "$tmp/out")" = "coredns-web-ui $version $commit" ] || fail "version output is not 'coredns-web-ui $version $commit'"
ok "version output"
capture docker run --rm "$image" help
capture docker run --rm --name "${name}-probe" "$image" help
expect_rc "help" 0
cmp -s "$tmp/out" "$tmp/usage" || fail "help output differs from the usage text"
[ ! -s "$tmp/err" ] || fail "help wrote to stderr"
ok "help output"
for args in "bogus" "help extra"; do
capture docker run --rm "$image" $args
capture docker run --rm --name "${name}-probe" "$image" $args
expect_rc "usage error ($args)" 2
[ ! -s "$tmp/out" ] || fail "usage error ($args) wrote to stdout"
head -n 1 "$tmp/err" | grep -q '^coredns-web-ui: usage error: ' || fail "usage error ($args) message has no usage error prefix"
@@ -153,7 +153,7 @@ for args in "bogus" "help extra"; do
done
ok "usage errors exit 2 with the usage text on stderr"
capture docker run --rm "$image" healthcheck
capture docker run --rm --name "${name}-probe" "$image" healthcheck
expect_rc "healthcheck without a server" 1
ok "healthcheck fails without a server"
@@ -200,9 +200,9 @@ capture docker exec "$server" /app healthcheck
expect_rc "docker exec healthcheck" 0
ok "docker exec healthcheck"
health=$(docker run --rm --network "$network" "$probe" wget -qO- http://app:8080/health) || fail "GET /health failed"
health=$(docker run --rm --name "${name}-probe" --network "$network" "$probe" wget -qO- http://app:8080/health) || fail "GET /health failed"
[ "$health" = '{"status":"ok"}' ] || fail "unexpected /health body: $health"
page=$(docker run --rm --network "$network" "$probe" wget -qO- http://app:8080/version) || fail "GET /version failed"
page=$(docker run --rm --name "${name}-probe" --network "$network" "$probe" wget -qO- http://app:8080/version) || fail "GET /version failed"
printf '%s' "$page" | grep -qF "$version" || fail "/version does not render the version"
printf '%s' "$page" | grep -qF "$commit" || fail "/version does not render the commit"
ok "/health and /version"