summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-10-29 17:04:38 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-01-21 21:31:59 -0800
commit424825a649ea0cd9bd4955fbfe9d5ba472e6bc38 (patch)
tree1941204296e340a7103679a0eae7b20173fd0e16 /tests
parent317eea0e182f45c0ccd14b1e83c832ba435ee283 (diff)
features/shard: Implement fallocate FOP
Backport of: http://review.gluster.org/13196 Change-Id: Iab0c41319af42210c871a3ed6cf52a987c5d88d7 BUG: 1299712 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/13259 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/shard/bug-shard-fallocate.t47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/bugs/shard/bug-shard-fallocate.t b/tests/bugs/shard/bug-shard-fallocate.t
new file mode 100644
index 00000000000..8d41507c4a5
--- /dev/null
+++ b/tests/bugs/shard/bug-shard-fallocate.t
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+
+cleanup
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1,2,3}
+TEST $CLI volume set $V0 features.shard on
+TEST $CLI volume start $V0
+
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
+
+# Create a file.
+TEST touch $M0/foo
+
+gfid_foo=`getfattr -n glusterfs.gfid.string $M0/foo 2>/dev/null \
+ | grep glusterfs.gfid.string | cut -d '"' -f 2`
+
+TEST fallocate -l 17M $M0/foo
+EXPECT '17825792' stat -c %s $M0/foo
+
+# This should ensure /.shard is created on the bricks.
+TEST stat $B0/${V0}0/.shard
+TEST stat $B0/${V0}1/.shard
+TEST stat $B0/${V0}2/.shard
+TEST stat $B0/${V0}3/.shard
+
+EXPECT "4194304" echo `find $B0 -name $gfid_foo.1 | xargs stat -c %s`
+EXPECT "4194304" echo `find $B0 -name $gfid_foo.2 | xargs stat -c %s`
+EXPECT "4194304" echo `find $B0 -name $gfid_foo.3 | xargs stat -c %s`
+EXPECT "1048576" echo `find $B0 -name $gfid_foo.4 | xargs stat -c %s`
+
+TEST fallocate -o 102400 -l 17M $M0/foo
+EXPECT '17928192' stat -c %s $M0/foo
+
+EXPECT "4194304" echo `find $B0 -name $gfid_foo.1 | xargs stat -c %s`
+EXPECT "4194304" echo `find $B0 -name $gfid_foo.2 | xargs stat -c %s`
+EXPECT "4194304" echo `find $B0 -name $gfid_foo.3 | xargs stat -c %s`
+EXPECT "1150976" echo `find $B0 -name $gfid_foo.4 | xargs stat -c %s`
+
+TEST umount $M0
+TEST $CLI volume stop $V0
+TEST $CLI volume delete $V0
+
+cleanup