Skip to content

Commit 98a4526

Browse files
committed
test(dind): assert public-mode passthrough actually copies a public host image (issue #96)
The host-image passthrough test only asserted the negative path for the default public mode: a locally-built fixture (no RepoDigest) is skipped. The positive path the feature exists for - a genuinely public image (carrying a RepoDigest from an allowlisted registry) IS copied into the inner daemon - was structurally untested. The throwaway host daemon was seeded with only the offline fixture, so public mode had no eligible image at all and a 'public copies nothing' regression would ship green. Seed the throwaway host daemon with a real pulled alpine:3.20 (pulling is what records a RepoDigest; docker save/load does not preserve one) and assert in the public-mode block that the image lands in the inner daemon and is logged as loaded. Closes the false-positive gap downstream (link-assistant/hive-mind#1879) relies on. Also drop the stray root .gitkeep PR-creation artifact. Fixes #96
1 parent 8cf872c commit 98a4526

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
bump: patch
3+
---
4+
5+
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.

.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/dind/example-preload-images.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ log "throwaway host daemon is ready"
145145
docker exec -i "$host_daemon_container" \
146146
docker -H unix:///sockets/docker.sock load < "$tarball_dir/image.tar"
147147

148+
# Also seed it with a genuinely public image. Pulling it from a public registry
149+
# is what records a RepoDigest (docker save/load does NOT preserve one), so this
150+
# is the "freely re-pullable" case the default public mode MUST pass through.
151+
# This is the positive counterpart to the fixture: without it, public mode has no
152+
# eligible image and a "public copies nothing" regression would ship green.
153+
public_image="alpine:3.20"
154+
log "pulling a real public image (${public_image}) into the throwaway host daemon"
155+
if ! $host_docker pull "$public_image" >/dev/null; then
156+
fail "could not pull ${public_image} into the throwaway host daemon (network required)"
157+
fi
158+
148159
# all mode: every tagged host image is copied, including this local fixture.
149160
log "starting consumer with DIND_HOST_PASSTHROUGH=all"
150161
run_dind_container "$all_container" \
@@ -174,6 +185,19 @@ if ! docker logs "$public_container" 2>&1 | grep -q "host-image passthrough (mod
174185
docker logs "$public_container" >&2 || true
175186
fail "expected the consumer to run host-image passthrough in public mode"
176187
fi
177-
log "public-mode passthrough correctly skipped the local fixture (security filter held)"
188+
# Positive assertion: a host image carrying a RepoDigest from an allowlisted
189+
# public registry MUST land in the inner daemon. This is the behavior downstream
190+
# relies on (link-assistant/hive-mind#1879) and the path the suite previously
191+
# left structurally untested, so a "public copies nothing" regression now fails.
192+
if ! docker exec "$public_container" docker image inspect "$public_image" >/dev/null 2>&1; then
193+
docker logs "$public_container" >&2 || true
194+
docker exec "$public_container" docker images >&2 || true
195+
fail "public mode must pass through a host image that has a public RepoDigest (${public_image})"
196+
fi
197+
if ! docker logs "$public_container" 2>&1 | grep -q "passthrough loading host image: ${public_image}"; then
198+
docker logs "$public_container" >&2 || true
199+
fail "expected public mode to log loading the public host image (${public_image})"
200+
fi
201+
log "public-mode passthrough copied the public image and skipped the local fixture (security filter held)"
178202

179203
log "preload example passed"

0 commit comments

Comments
 (0)