Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: --image-volume test: robustify #24612

Merged
merged 1 commit into from
Nov 19, 2024
Merged
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
16 changes: 8 additions & 8 deletions test/system/160-volumes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ NeedsChown | true
FROM $IMAGE
VOLUME /data
EOF
fs=$(stat -f -c %T .)
run_podman build -t volume_image $tmpdir

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

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

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

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