aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_bindfs.rb
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2012-05-18 12:30:31 +0300
committerMartin Pärtel <martin.partel@gmail.com>2012-05-18 12:30:31 +0300
commit1cfc042b5a5e6dc8ea5d81d9d719d472a1800167 (patch)
tree3d1eb3f2d8661d90d57d2f0364bee3ed9eba7fbb /tests/test_bindfs.rb
parentcb4cf90bd7e13ecb7b2a286d548fe853796948c4 (diff)
downloadbindfs-1cfc042b5a5e6dc8ea5d81d9d719d472a1800167.tar.gz
Fixed --create-as-user.
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-xtests/test_bindfs.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index ff1ee24..1f78250 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -74,6 +74,28 @@ testenv("-u nobody -m #{Process.uid} -p 0600,u+D") do
assert { File.stat('mnt/file').uid == Process.uid }
end
+root_testenv("", :title => "--create-as-user should be default for root") do
+ chmod(0777, 'src')
+ `su -c 'touch mnt/file' nobody`
+ `su -c 'mkdir mnt/dir' nobody`
+ `su -c 'ln -sf /tmp/foo mnt/lnk' nobody`
+
+ assert { File.stat('mnt/file').uid == nobody_uid }
+ assert { File.stat('mnt/file').gid == nogroup_gid }
+ assert { File.stat('src/file').uid == nobody_uid }
+ assert { File.stat('src/file').gid == nogroup_gid }
+
+ assert { File.stat('mnt/dir').uid == nobody_uid }
+ assert { File.stat('mnt/dir').gid == nogroup_gid }
+ assert { File.stat('src/dir').uid == nobody_uid }
+ assert { File.stat('src/dir').gid == nogroup_gid }
+
+ assert { File.lstat('mnt/lnk').uid == nobody_uid }
+ assert { File.lstat('mnt/lnk').gid == nogroup_gid }
+ assert { File.lstat('src/lnk').uid == nobody_uid }
+ assert { File.lstat('src/lnk').gid == nogroup_gid }
+end
+
testenv("--create-with-perms=og=r:ogd+x") do
touch('src/file')
mkdir('src/dir')