summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2013-05-09 16:14:33 +0000
committerVijay Bellur <vbellur@redhat.com>2013-05-13 01:33:17 -0700
commit0d415f7f8c08edc7b7af88567bb5ec4803defc94 (patch)
tree6f85014a9d952800d56e9f69a9334ed9ac4e05bb /tests
parentfd36cabb0db4139cba97fc75c6169b57ebea3e9d (diff)
glusterd: remove-brick: prevent removal from a replicate volume.
Prevent the removal of brick(s) from a plain replicate volume and display the error message at the CLI. Change-Id: I8e182404564147329d8cd364b7c7931d19f14570 BUG: 961669 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/4975 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/bug-961669.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/bugs/bug-961669.t b/tests/bugs/bug-961669.t
new file mode 100644
index 00000000000..1b83262253c
--- /dev/null
+++ b/tests/bugs/bug-961669.t
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+#Test case: Create a replicate volume; mount and write to it; kill one brick; try to remove the other.
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+#Basic checks
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume info
+
+#Create a 1x2 replicate volume
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1};
+TEST $CLI volume start $V0
+
+# Mount FUSE and create file/directory
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
+TEST touch $M0/zerobytefile.txt
+TEST mkdir $M0/test_dir
+TEST dd if=/dev/zero of=$M0/file bs=1024 count=1024
+
+#Kill one of the bricks. This step can be skipped without affecting the outcome of the test.
+kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-${V0}1.pid`;
+
+function remove_brick_status {
+ $CLI volume remove-brick $V0 replica 1 $H0:$B0/${V0}1 start 2>&1
+}
+
+#Remove brick
+EXPECT "volume remove-brick start: failed: Removing brick from a replicate volume is not allowed" remove_brick_status;
+
+#Check the volume type
+EXPECT "Replicate" echo `$CLI volume info |grep Type |awk '{print $2}'`
+
+TEST umount $M0
+TEST $CLI volume stop $V0
+TEST $CLI volume delete $V0;
+TEST ! $CLI volume info $V0;
+
+cleanup;