Skip to content

Commit

Permalink
test/system: fix podman --image-volume to allow tmpfs storage
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luap99 committed Jul 1, 2024
1 parent e810b34 commit fad1f75
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/system/160-volumes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,15 @@ EOF
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm volume_image stat -f -c %T /data
is "$output" "tmpfs" "Should be tmpfs"

CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image stat -f -c %T /data
assert "$output" != "tmpfs" "Should match hosts $fs"
# get the hostfs first so we can match it below
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
is "$output" "tmpfs" "Should be tmpfs"
Expand Down

0 comments on commit fad1f75

Please sign in to comment.