Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/issue-96-public-passthrough-positive-assertion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
bump: patch
---

dind-box: close a false-positive coverage gap in the host-image passthrough test (issue #96). `tests/dind/example-preload-images.sh` previously only asserted that `public` mode skips a locally-built fixture (no RepoDigest); it never asserted the positive path — that a genuinely public image (carrying a RepoDigest from an allowlisted registry) IS copied into the inner daemon. The throwaway host daemon is now also seeded with a real pulled `alpine:3.20`, and the `public`-mode block asserts that image lands in the nested daemon and is logged as loaded. A "public copies nothing" regression — the exact symptom downstream (`link-assistant/hive-mind#1879`) relies on not happening — now fails CI instead of shipping green.
26 changes: 25 additions & 1 deletion tests/dind/example-preload-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ log "throwaway host daemon is ready"
docker exec -i "$host_daemon_container" \
docker -H unix:///sockets/docker.sock load < "$tarball_dir/image.tar"

# Also seed it with a genuinely public image. Pulling it from a public registry
# is what records a RepoDigest (docker save/load does NOT preserve one), so this
# is the "freely re-pullable" case the default public mode MUST pass through.
# This is the positive counterpart to the fixture: without it, public mode has no
# eligible image and a "public copies nothing" regression would ship green.
public_image="alpine:3.20"
log "pulling a real public image (${public_image}) into the throwaway host daemon"
if ! $host_docker pull "$public_image" >/dev/null; then
fail "could not pull ${public_image} into the throwaway host daemon (network required)"
fi

# all mode: every tagged host image is copied, including this local fixture.
log "starting consumer with DIND_HOST_PASSTHROUGH=all"
run_dind_container "$all_container" \
Expand Down Expand Up @@ -174,6 +185,19 @@ if ! docker logs "$public_container" 2>&1 | grep -q "host-image passthrough (mod
docker logs "$public_container" >&2 || true
fail "expected the consumer to run host-image passthrough in public mode"
fi
log "public-mode passthrough correctly skipped the local fixture (security filter held)"
# Positive assertion: a host image carrying a RepoDigest from an allowlisted
# public registry MUST land in the inner daemon. This is the behavior downstream
# relies on (link-assistant/hive-mind#1879) and the path the suite previously
# left structurally untested, so a "public copies nothing" regression now fails.
if ! docker exec "$public_container" docker image inspect "$public_image" >/dev/null 2>&1; then
docker logs "$public_container" >&2 || true
docker exec "$public_container" docker images >&2 || true
fail "public mode must pass through a host image that has a public RepoDigest (${public_image})"
fi
if ! docker logs "$public_container" 2>&1 | grep -q "passthrough loading host image: ${public_image}"; then
docker logs "$public_container" >&2 || true
fail "expected public mode to log loading the public host image (${public_image})"
fi
log "public-mode passthrough copied the public image and skipped the local fixture (security filter held)"

log "preload example passed"