test/system: fix podman --image-volume to allow tmpfs storage

The test check the the default volume is not on tmpfs, however what it
should really check that the volume is on our container storage fs. It
is possible that users run the storage on top of tmpfs so this test
always failed there.

The better check is to compare the fs from the graphroot and the volume.
Unfortunately, for unknown reasons stat -f -c %T returns UNKNOWN and not
the actual fs. I have no idea why, to work around that we now parse
/proc/mounts manually for the fs. Not nice but at least it works
correctly.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2024-05-29 16:05:17 +02:00
parent e810b340ef
commit fad1f757cc
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 9 additions and 2 deletions

View File

@ -534,8 +534,15 @@ EOF
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm volume_image stat -f -c %T /data CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm volume_image stat -f -c %T /data
is "$output" "tmpfs" "Should be tmpfs" is "$output" "tmpfs" "Should be tmpfs"
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image stat -f -c %T /data # get the hostfs first so we can match it below
assert "$output" != "tmpfs" "Should match hosts $fs" run_podman info --format {{.Store.GraphRoot}}
hostfs=$(stat -f -c %T $output)
# stat -f -c %T seems to just return unknown for our normal bind mount for some reason.
# Therfore 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"
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume tmpfs --rm volume_image stat -f -c %T /data CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume tmpfs --rm volume_image stat -f -c %T /data
is "$output" "tmpfs" "Should be tmpfs" is "$output" "tmpfs" "Should be tmpfs"