summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2012-01-24 02:24:23 -0800
committerGerrit Code Review <root@dev.gluster.com>2012-01-24 02:24:23 -0800
commitd9e30abf98ab45b487770a91eab6954361e72a7e (patch)
tree28309f117b67eeaa0c29606b607d003ff8c2b3e1
parent322ff47091febfd085a598be2750a266d79f4ce3 (diff)
parentb172bd4e3d566697003b9858487104eceff7a5bf (diff)
Merge "BUG:765307-check subdirectory migration"
-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