summaryrefslogtreecommitdiff
path: root/test/system/160-volumes.bats
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-10-13 16:24:46 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-10-15 14:27:14 -0400
commit207abc4a9ada6dcc03420a02e243041d2f2f1c79 (patch)
treeaede6180cdc3abd04928383ab00b86c94b74c067 /test/system/160-volumes.bats
parent171f7b8975194ff9f47a3dd23adec81d11e6d104 (diff)
downloadpodman-207abc4a9ada6dcc03420a02e243041d2f2f1c79.tar.gz
podman-207abc4a9ada6dcc03420a02e243041d2f2f1c79.tar.bz2
podman-207abc4a9ada6dcc03420a02e243041d2f2f1c79.zip
We should only be relabeling when on first run
On the second runs, the labels should be the same so no need to relabel. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2013548 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/system/160-volumes.bats')
-rw-r--r--test/system/160-volumes.bats30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index 7128f1b65..43462de36 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -210,6 +210,36 @@ EOF
run_podman volume rm my_vol2
}
+# Podman volume user test
+@test "podman volume user test" {
+ is_rootless || skip "only meaningful when run rootless"
+ user="1000:2000"
+ newuser="100:200"
+ tmpdir=${PODMAN_TMPDIR}/volume_$(random_string)
+ mkdir $tmpdir
+ touch $tmpdir/test1
+
+ run_podman run --name user --user $user -v $tmpdir:/data:U $IMAGE stat -c "%u:%g" /data
+ is "$output" "$user" "user should be changed"
+
+ # Now chown the source directory and make sure recursive chown happens
+ run_podman unshare chown -R $newuser $tmpdir
+ run_podman start --attach user
+ is "$output" "$user" "user should be the same"
+
+ # Now chown the file in source directory and make sure recursive chown
+ # doesn't happen
+ run_podman unshare chown -R $newuser $tmpdir/test1
+ run_podman start --attach user
+ is "$output" "$user" "user should be the same"
+ # test1 should still be chowned to $newuser
+ run_podman unshare stat -c "%u:%g" $tmpdir/test1
+ is "$output" "$newuser" "user should not be changed"
+
+ run_podman unshare rm $tmpdir/test1
+ run_podman rm user
+}
+
# Confirm that container sees the correct id
@test "podman volume with --userns=keep-id" {