summaryrefslogtreecommitdiff
path: root/test/system/160-volumes.bats
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-16 06:04:22 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-02-28 14:26:22 -0500
commit3dc1b8e83f2459a58d65f3bb918975cd6f1bb794 (patch)
tree15a3d902665203a36ad06965e79997434567e8c5 /test/system/160-volumes.bats
parentc39dffe83db9fa3cfa6897b971956821f1bbcce2 (diff)
downloadpodman-3dc1b8e83f2459a58d65f3bb918975cd6f1bb794.tar.gz
podman-3dc1b8e83f2459a58d65f3bb918975cd6f1bb794.tar.bz2
podman-3dc1b8e83f2459a58d65f3bb918975cd6f1bb794.zip
Add podman volume mount support
Fixes: https://github.com/containers/podman/issues/12768 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/system/160-volumes.bats')
-rw-r--r--test/system/160-volumes.bats25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index a3c972b3e..d0088b994 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -387,4 +387,29 @@ NeedsChown | true
run_podman volume rm $myvolume
}
+@test "podman volume mount" {
+ skip_if_remote "podman --remote volume mount not supported"
+ myvolume=myvol$(random_string)
+ myfile=myfile$(random_string)
+ mytext=$(random_string)
+
+ # Create a named volume
+ run_podman volume create $myvolume
+ is "$output" "$myvolume" "output from volume create"
+
+ if ! is_rootless ; then
+ # image mount is hard to test as a rootless user
+ # and does not work remotely
+ run_podman volume mount ${myvolume}
+ mnt=${output}
+ echo $mytext >$mnt/$myfile
+ run_podman run -v ${myvolume}:/vol:z $IMAGE cat /vol/$myfile
+ is "$output" "$mytext" "$myfile should exist within the containers volume and contain $mytext"
+ run_podman volume unmount ${myvolume}
+ else
+ run_podman 125 volume mount ${myvolume}
+ is "$output" "Error: cannot run command \"podman volume mount\" in rootless mode, must execute.*podman unshare.*first" "Should fail and complain about unshare"
+ fi
+}
+
# vim: filetype=sh