Skip to content

Commit dd97d3e

Browse files
Merge pull request #24612 from edsantiago/fix-160
CI: --image-volume test: robustify
2 parents 569fefc + 97ed067 commit dd97d3e

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

test/system/160-volumes.bats

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ NeedsChown | true
516516
FROM $IMAGE
517517
VOLUME /data
518518
EOF
519-
fs=$(stat -f -c %T .)
520519
run_podman build -t volume_image $tmpdir
521520

522521
containersconf=$tmpdir/containers.conf
@@ -534,15 +533,16 @@ EOF
534533
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm volume_image stat -f -c %T /data
535534
is "$output" "tmpfs" "Should be tmpfs"
536535

537-
# get the hostfs first so we can match it below
536+
# Get the hostfs first so we can match it below. The important check is
537+
# the HEX filesystem type (%t); readable one (%T) is for ease of debugging.
538+
# We can't compare %T because our alpine-based testimage doesn't grok btrfs.
538539
run_podman info --format {{.Store.GraphRoot}}
539-
hostfs=$(stat -f -c %T $output)
540+
hostfs=$(stat -f -c '%t %T' $output)
541+
echo "# for debug: stat( $output ) = '$hostfs'"
540542

541-
# stat -f -c %T seems to just return unknown for our normal bind mount for some reason.
542-
# Therefore manually parse /proc/mounts to get the real fs for the bind mount.
543-
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image \
544-
sh -c "grep ' /data ' /proc/mounts | cut -f3 -d' '"
545-
assert "$output" == "$hostfs" "Should match hosts graphroot fs"
543+
# "${foo%% *}" strips everything after the first space: "9123683e btrfs" -> "9123683e"
544+
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image stat -f -c '%t %T' /data
545+
assert "${output%% *}" == "${hostfs%% *}" "/data fs type should match hosts graphroot"
546546

547547
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume tmpfs --rm volume_image stat -f -c %T /data
548548
is "$output" "tmpfs" "Should be tmpfs"

0 commit comments

Comments
 (0)