|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Regression test for devcontainers/features#1639 / PR #1645 follow-up: |
| 4 | +# verifies that when the dev container's root filesystem is overlayfs |
| 5 | +# (the default under Docker / containerd-backed hosts), the standalone |
| 6 | +# containerd started by the docker-in-docker Feature does NOT place its |
| 7 | +# overlayfs snapshotter data on an overlay rootfs (which would fail with |
| 8 | +# `invalid argument` when pulling images). |
| 9 | +# |
| 10 | +set -e |
| 11 | + |
| 12 | +source dev-container-features-test-lib |
| 13 | + |
| 14 | +# 1. Confirm we're really reproducing the affected condition: |
| 15 | +# the dev container's / must be overlay. |
| 16 | +check "rootfs is overlay (precondition)" \ |
| 17 | + bash -c '[ "$(findmnt -no FSTYPE /)" = "overlay" ]' |
| 18 | + |
| 19 | +# 2. The Feature's volume mount must shadow /var/lib/containerd with a |
| 20 | +# non-overlay filesystem. Without the mount, containerd's overlayfs |
| 21 | +# snapshotter would be writing onto the overlay rootfs and fail at |
| 22 | +# pull time. |
| 23 | +check "/var/lib/containerd is not overlay" \ |
| 24 | + bash -c '[ "$(findmnt -no FSTYPE /var/lib/containerd)" != "overlay" ]' |
| 25 | + |
| 26 | +check "/var/lib/docker is not overlay" \ |
| 27 | + bash -c '[ "$(findmnt -no FSTYPE /var/lib/docker)" != "overlay" ]' |
| 28 | + |
| 29 | +# 3. The actual symptom: pulling and running an image must succeed. |
| 30 | +# Pre-PR-#1645 this fails with: |
| 31 | +# failed to mount /tmp/containerd-mountXXXXX ... err: invalid argument |
| 32 | +check "docker run hello-world" \ |
| 33 | + docker run --rm hello-world |
| 34 | + |
| 35 | +# 4. Belt-and-braces: confirm dockerd is actually using the |
| 36 | +# containerd-snapshotter path so we know this test exercises the |
| 37 | +# affected code path, not the legacy overlay2 driver. |
| 38 | +check "containerd-snapshotter active" \ |
| 39 | + bash -c "docker info 2>/dev/null | grep -qiE 'driver-type: io.containerd.snapshotter.v1|Storage Driver: overlayfs'" |
| 40 | + |
| 41 | +reportResults |
| 42 | + |
0 commit comments