summaryrefslogtreecommitdiffstats
path: root/tests/bugs
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:15:04 -0700
commit470a50b1d5017f015a1f3f3ea65a33902a02ffea (patch)
tree4627307c0ce2c5d15da3d6655b5d2ead48166dc1 /tests/bugs
parenta4bbb71e91744ed387606dd4eb5bee55cf86b079 (diff)
features/shard: Ensure shards are owned by the same owner/group as the original file
Change-Id: Id759af8f3ff5fd8bfa9f8121bab25722709d42b7 BUG: 1251824 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/11874 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'tests/bugs')
-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;