Test suite: Fix the timeouts on the skip share check tests.
[vlendec/samba-autobuild/.git] / ctdb / tests / simple / 04_ctdb_setvar.sh
index a3641b098fec42e9571f4763f916f6521735821e..e8eda3abc4364c465c6f9842044d9d981f87e014 100755 (executable)
@@ -36,32 +36,28 @@ ctdb_test_init "$@"
 
 set -e
 
-onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
+cluster_is_healthy
 
-var="RecoverTimeout"
+# Reset configuration
+ctdb_restart_when_done
 
-cmd="ctdb getvar $var"
-try_command_on_node 0 $cmd
+var="RecoverTimeout"
 
-val=$(echo "$out" | sed -e 's@.*[[:space:]]@@')
+try_command_on_node -v 0 $CTDB getvar $var
 
-echo "$out"
+val="${out#*= }"
 
 echo "Going to try incrementing it..."
 
 incr=$(($val + 1))
 
-cmd="ctdb setvar $var $incr"
-try_command_on_node 0 $cmd
+try_command_on_node 0 $CTDB setvar $var $incr
 
 echo "That seemed to work, let's check the value..."
 
-cmd="ctdb getvar $var"
-try_command_on_node 0 $cmd
-
-newval=$(echo "$out" | sed -e 's@.*[[:space:]]@@')
+try_command_on_node -v 0 $CTDB getvar $var
 
-echo "$out"
+newval="${out#*= }"
 
 if [ "$incr" != "$newval" ] ; then
     echo "Nope, that didn't work..."
@@ -69,13 +65,9 @@ if [ "$incr" != "$newval" ] ; then
 fi
 
 echo "Look's good!  Now verifying with \"ctdb listvars\""
-cmd="ctdb listvars"
-try_command_on_node 0 $cmd
-
-line=$(echo "$out" | grep "^$var")
-echo "$line"
+try_command_on_node -v 0 "$CTDB listvars | grep '^$var'"
 
-check=$(echo "$line" | sed -e 's@.*[[:space:]]@@')
+check="${out#*= }"
 
 if [ "$incr" != "$check" ] ; then
     echo "Nope, that didn't work..."
@@ -83,9 +75,5 @@ if [ "$incr" != "$check" ] ; then
 fi
 
 echo "Look's good!  Putting the old value back..."
-cmd="ctdb setvar $var $val"
+cmd="$CTDB setvar $var $val"
 try_command_on_node 0 $cmd
-
-echo "All done..."
-
-ctdb_test_exit