From 8ea6882c424afd3f18ad1273ec31d34f5d74e47e Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 28 Oct 2010 07:02:44 +0000 Subject: script for testing glusterd sanity Signed-off-by: Raghavendra Bhat Signed-off-by: Anand V. Avati BUG: 1436 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1436 --- extras/test/gluster_commands.sh | 43 +++++++++++++++++++++++++++++++++++++---- extras/test/run.sh | 31 +++++++++++++++++++++++++++++ extras/test/stop_glusterd.sh | 28 +++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 4 deletions(-) create mode 100755 extras/test/run.sh create mode 100755 extras/test/stop_glusterd.sh (limited to 'extras/test') diff --git a/extras/test/gluster_commands.sh b/extras/test/gluster_commands.sh index 5e7aea6fb..6774f2262 100755 --- a/extras/test/gluster_commands.sh +++ b/extras/test/gluster_commands.sh @@ -20,6 +20,15 @@ # This script tests the basics gluster cli commands. +echo "Starting glusterd" +glusterd +if [ $? -ne 0 ]; then + echo "Could not start glusterd.Exiting" + exit; +else + echo "glusterd started" +fi + if [ ! -d "/exports" ]; then mkdir /exports; mkdir /exports/exp{1..10}; @@ -59,20 +68,29 @@ sleep 1 echo "replacing brick......" gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 status gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 pause gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 status gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 status gluster volume replace-brick vol `hostname`:/exports/exp1 `hostname`:/exports/exp3 commit echo "replcing brick for abort operation" gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 status gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 pause gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 status gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 start +#sleep for 5 seconds +sleep 5 +gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 status gluster volume replace-brick vol `hostname`:/exports/exp3 `hostname`:/exports/exp1 abort @@ -96,7 +114,7 @@ umount /mnt/client df -h echo "deleting distribute volume......" -gluster volume delete vol +gluster --mode=script volume delete vol gluster volume info sleep 1 @@ -124,10 +142,14 @@ sleep 1 echo "replacing-brick....." gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 status gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 pause gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 status gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 status gluster volume replace-brick mirror `hostname`:/exports/exp1 `hostname`:/exports/exp5 commit gluster volume info @@ -135,12 +157,16 @@ sleep 1 df -h sleep 1 -echo "replacing vrick for abort operation" +echo "replacing brick for abort operation" gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 status gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 pause gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 status gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp1 status gluster volume replace-brick mirror `hostname`:/exports/exp5 `hostname`:/exports/exp5 abort @@ -164,7 +190,7 @@ umount /mnt/client df -h echo "deleting replicate volume....." -gluster volume delete mirror +gluster --mode=script volume delete mirror gluster volume info sleep 1 @@ -193,10 +219,14 @@ sleep 1 echo "replacing brick....." gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 status gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 pause gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 status gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 status gluster volume replace-brick str `hostname`:/exports/exp1 `hostname`:/exports/exp5 commit @@ -207,10 +237,14 @@ sleep 1 echo "replacing brick for abort operation" gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 status gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 pause gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 status gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 start +#sleep for 5 seconds +sleep 5 gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 status gluster volume replace-brick str `hostname`:/exports/exp5 `hostname`:/exports/exp1 abort @@ -234,5 +268,6 @@ umount /mnt/client df -h echo "deleting stripe volume....." -gluster volume delete str +gluster --mode=script volume delete str gluster volume info + diff --git a/extras/test/run.sh b/extras/test/run.sh new file mode 100755 index 000000000..e014a1033 --- /dev/null +++ b/extras/test/run.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# Copyright (c) 2006-2010 Gluster, Inc. +# This file is part of GlusterFS. + +# GlusterFS is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3 of the License, +# or (at your option) any later version. + +# GlusterFS is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +# Running gluster sanity test which starts glusterd and runs gluster commands, and exit at the first failure. +$PWD/gluster_commands.sh + +if [ $? -ne 0 ]; then + echo "sanity failed" +else + echo "sanity passed" +fi + +# Stopping glusterd +$PWD/stop_glusterd.sh + diff --git a/extras/test/stop_glusterd.sh b/extras/test/stop_glusterd.sh new file mode 100755 index 000000000..7dfc8686c --- /dev/null +++ b/extras/test/stop_glusterd.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Copyright (c) 2006-2010 Gluster, Inc. +# This file is part of GlusterFS. + +# GlusterFS is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3 of the License, +# or (at your option) any later version. + +# GlusterFS is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +#This script stops the glusterd running on the machine. Helpful for gluster sanity script + +killall -9 glusterd + +if [ $? -ne 0 ]; then + echo "Error: Could not kill glusterd. Either glusterd is not running or kill it manually" +else + echo "Killed glusterd" +fi -- cgit