summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-06 15:16:13 +0100
committerGitHub <noreply@github.com>2022-01-06 15:16:13 +0100
commit755b7aa5214183a0358116e783affdc1d7dd7db4 (patch)
treef8faf3663005e17e1494a9bbb13b135e08987e90 /test
parent8d5d0e7c6d496ac73a187d502e7f8e73dc0bc617 (diff)
parent2e0d3e9ea45f9ebb77ffe1f9022b46f0e429fb5e (diff)
downloadpodman-755b7aa5214183a0358116e783affdc1d7dd7db4.tar.gz
podman-755b7aa5214183a0358116e783affdc1d7dd7db4.tar.bz2
podman-755b7aa5214183a0358116e783affdc1d7dd7db4.zip
Merge pull request #12687 from rhatdan/volume
Support volume bind mounts for rootless containers
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 dcf7cf0a7..36a88fc10 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