summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-12-22 15:07:37 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-01-04 13:48:03 -0500
commit2e0d3e9ea45f9ebb77ffe1f9022b46f0e429fb5e (patch)
tree54d1993a8873396bbf41d24b5c7235f6195ba166 /test
parent47cf00eb1349e7823b2c4286e39a517ea4657242 (diff)
downloadpodman-2e0d3e9ea45f9ebb77ffe1f9022b46f0e429fb5e.tar.gz
podman-2e0d3e9ea45f9ebb77ffe1f9022b46f0e429fb5e.tar.bz2
podman-2e0d3e9ea45f9ebb77ffe1f9022b46f0e429fb5e.zip
Support all volume mounts for rootless containers
Fix handling of "bind" and "tmpfs" olumes to actually work. Allow bind, tmpfs local volumes to work in rootless mode. Also removed the string "error" from all error messages that begine with it. All Podman commands are printed with Error:, so this causes an ugly stutter. Fixes: https://github.com/containers/podman/issues/12013 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/160-volumes.bats25
-rw-r--r--test/system/helpers.bash2
2 files changed, 26 insertions, 1 deletions
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index 43462de36..1271b7c0b 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -319,5 +319,30 @@ EOF
is "$output" "" "no more volumes to prune"
}
+@test "podman volume type=bind" {
+ myvoldir=${PODMAN_TMPDIR}/volume_$(random_string)
+ mkdir $myvoldir
+ touch $myvoldir/myfile
+
+ myvolume=myvol$(random_string)
+ run_podman 125 volume create -o type=bind -o device=/bogus $myvolume
+ is "$output" "Error: invalid volume option device for driver 'local': stat /bogus: no such file or directory" "should fail with bogus directory not existing"
+
+ run_podman volume create -o type=bind -o device=/$myvoldir $myvolume
+ is "$output" "$myvolume" "should successfully create myvolume"
+
+ run_podman run --rm -v $myvolume:/vol:z $IMAGE \
+ stat -c "%u:%s" /vol/myfile
+ is "$output" "0:0" "w/o keep-id: stat(file in container) == root"
+}
+
+@test "podman volume type=tmpfs" {
+ myvolume=myvol$(random_string)
+ run_podman volume create -o type=tmpfs -o device=tmpfs $myvolume
+ is "$output" "$myvolume" "should successfully create myvolume"
+
+ run_podman run --rm -v $myvolume:/vol $IMAGE stat -f -c "%T" /vol
+ is "$output" "tmpfs" "volume should be tmpfs"
+}
# vim: filetype=sh
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 415c9010e..7be694dbd 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -63,7 +63,7 @@ function basic_setup() {
for line in "${lines[@]}"; do
set $line
echo "# setup(): removing stray external container $1 ($2)" >&3
- run_podman rm $1
+ run_podman rm -f $1
done
# Clean up all images except those desired