summaryrefslogtreecommitdiffstats
path: root/dvm/765307/testcase
diff options
context:
space:
mode:
authorshylesh <shmohan@redhat.com>2012-01-07 23:08:33 +0530
committershylesh <shmohan@redhat.com>2012-01-23 22:52:37 +0530
commitb172bd4e3d566697003b9858487104eceff7a5bf (patch)
treef1887c05272f902ab96ae7bf1c39b6f16b8338c4 /dvm/765307/testcase
parent998550d430213f0bdf216ec8126cf9978b69a989 (diff)
BUG:765307-check subdirectory migration
Change-Id: I42355aa85fe6ee6539d9dcce86dafffc0d974758 BUG: 765307 Signed-off-by: shylesh <shmohan@redhat.com>
Diffstat (limited to 'dvm/765307/testcase')
-rwxr-xr-xdvm/765307/testcase82
1 files changed, 82 insertions, 0 deletions
diff --git a/dvm/765307/testcase b/dvm/765307/testcase
new file mode 100755
index 0000000..b00c04f
--- /dev/null
+++ b/dvm/765307/testcase
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+source $cwd/regression_helpers
+
+$GLUSTERFSDIR/gluster volume create $global_bug_id $(hostname):$EXPORT_DIR/$global_bug_id/brick1\
+ $(hostname):$EXPORT_DIR/$global_bug_id/brick2 2>/dev/null 1>/dev/null
+
+$GLUSTERFSDIR/gluster volume start $global_bug_id 2>/dev/null 1>/dev/null
+
+mount_glusterfs $global_bug_id
+
+cd $FUSE_MOUNT
+
+# Creating directory tree with depth 100
+
+for i in {1..100}
+do
+ mkdir $i
+ cd $i
+ touch $i
+done
+
+# come back to topmost directory
+cd $FUSE_MOUNT
+
+# replace a brick with force
+$GLUSTERFSDIR/gluster volume replace-brick $global_bug_id $(hostname):$EXPORT_DIR/$global_bug_id/brick2 \
+ $(hostname):$EXPORT_DIR/$global_bug_id/brick3 start 1>/dev/null 2>/dev/null
+
+time_out=0
+status=0
+
+while [[ $status -ne 1 && $time_out -le 300 ]]
+do
+ status=$($GLUSTERFSDIR/gluster volume replace-brick $global_bug_id\
+ $(hostname):$EXPORT_DIR/$global_bug_id/brick2\
+ $(hostname):$EXPORT_DIR/$global_bug_id/brick3 status | grep 'Migration complete'|wc -l)
+
+ time_out=$(( $time_out + 1))
+ sleep 1
+done
+
+if [ $time_out -gt 300 ]; then
+ exit 1
+fi
+
+$GLUSTERFSDIR/gluster volume replace-brick $global_bug_id\
+ $(hostname):$EXPORT_DIR/$global_bug_id/brick2\
+ $(hostname):$EXPORT_DIR/$global_bug_id/brick3 commit\
+ |grep 'replace-brick commit successful' 1>/dev/null 2>/dev/null
+
+ret=$?
+if [ $ret -ne 0 ]; then
+ exit 1
+fi
+
+# unmount and mount
+# to see the files immediately on the mount point
+# otherwise some of the files shown as not present
+# on the replaced brick
+
+cd /
+umount -f $FUSE_MOUNT
+sleep 5
+mount_glusterfs $global_bug_id
+sleep 5
+cd $FUSE_MOUNT
+
+# now check the directories in all levels are preserved
+for i in {1..100}
+do
+ if [ ! -d "$i" ]; then
+ exit 1
+ else
+ cd $i
+ if [ ! -f "$i" ]; then
+ exit 1
+ fi
+ fi
+done
+
+exit 0