summaryrefslogtreecommitdiffstats
path: root/tests/bugs/shard
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-08-10 19:10:21 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-08-19 02:27:32 -0700
commit5d9668dbb4f20ec7ce385e1d348e46b1425e4e84 (patch)
tree731ad3c9e5fd764700d4c48ba3d8f775ebf1d9ac /tests/bugs/shard
parent4fa5f8ccdcfeac20dbee8a0bc4753e5ca607a4d1 (diff)
features/shard: Ensure shards are owned by the same owner/group as the original file
Backport of: http://review.gluster.org/#/c/11874/ Change-Id: I8c905917430c32eb2e6573968722920d3b27fb55 BUG: 1253151 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/11927 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'tests/bugs/shard')
-rw-r--r--tests/bugs/shard/bug-1251824.t61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/bugs/shard/bug-1251824.t b/tests/bugs/shard/bug-1251824.t
new file mode 100644
index 00000000000..71bfdc7fdae
--- /dev/null
+++ b/tests/bugs/shard/bug-1251824.t
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 $H0:$B0/${V0}{0,1}
+TEST $CLI volume set $V0 features.shard on
+TEST $CLI volume start $V0
+
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
+TEST useradd -M test_user 2>/dev/null
+
+# Create 3 files as root.
+TEST touch $M0/foo
+TEST touch $M0/bar
+TEST touch $M0/baz
+
+# Change ownership to non-root on foo and bar.
+TEST chown test_user:test_user $M0/foo
+TEST chown test_user:test_user $M0/bar
+
+# Write 6M of data on foo as non-root, 2M overflowing into block-1.
+su -m test_user -c "dd if=/dev/zero of=$M0/foo bs=1M count=6"
+
+# Ensure owner and group are same on the shard as the main file.
+gfid_foo=`getfattr -n glusterfs.gfid.string $M0/foo 2>/dev/null \
+ | grep glusterfs.gfid.string | cut -d '"' -f 2`
+
+EXPECT "test_user" echo `find $B0 -name $gfid_foo.1 | xargs stat -c %U`
+EXPECT "test_user" echo `find $B0 -name $gfid_foo.1 | xargs stat -c %G`
+
+# Write 6M of data on bar as root.
+TEST dd if=/dev/zero of=$M0/bar bs=1M count=6
+
+# Ensure owner and group are same on the shard as the main file.
+gfid_bar=`getfattr -n glusterfs.gfid.string $M0/bar 2>/dev/null \
+ | grep glusterfs.gfid.string | cut -d '"' -f 2`
+
+EXPECT "test_user" echo `find $B0 -name $gfid_bar.1 | xargs stat -c %U`
+EXPECT "test_user" echo `find $B0 -name $gfid_bar.1 | xargs stat -c %G`
+
+# Write 6M of data on baz as root.
+TEST dd if=/dev/zero of=$M0/baz bs=1M count=6
+
+# Ensure owner andgroup are same on the shard as the main file.
+gfid_baz=`getfattr -n glusterfs.gfid.string $M0/baz 2>/dev/null \
+ | grep glusterfs.gfid.string | cut -d '"' -f 2`
+
+EXPECT "root" echo `find $B0 -name $gfid_baz.1 | xargs stat -c %U`
+EXPECT "root" echo `find $B0 -name $gfid_baz.1 | xargs stat -c %G`
+userdel test_user
+
+TEST umount $M0
+
+TEST $CLI volume stop $V0
+TEST $CLI volume delete $V0
+
+cleanup;