[SCM] CTDB repository - branch master updated - ctdb-1.0.84-20-gfc69b6a

Ronnie Sahlberg sahlberg at samba.org
Fri Jun 19 08:04:19 GMT 2009


The branch, master has been updated
       via  fc69b6a66282d5be6edeb286bf72aeafb252e6dd (commit)
      from  5d320099025b6835eda3a1e431708f7e0a6b0ba6 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit fc69b6a66282d5be6edeb286bf72aeafb252e6dd
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 19 11:40:09 2009 +1000

    Clean up handling the of CTDB restarts in testcases.
    
    Glitches during restarts of the CTDB cluster have been causing some
    tests to fail.  This is because restarts are initiated in the body of
    many tests.  This adds a simple function ctdb_restart_when_done, which
    schedules a restart using an existing hook in the test exit code.
    This function is now used in tests that need to restart CTDB.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 tests/scripts/ctdb_test_functions.bash             |   11 +++++++++++
 tests/simple/04_ctdb_setvar.sh                     |    6 ++++--
 tests/simple/16_ctdb_config_add_ip.sh              |    6 +++---
 tests/simple/17_ctdb_config_delete_ip.sh           |    6 ++++--
 tests/simple/18_ctdb_freeze.sh                     |    7 ++++---
 tests/simple/20_ctdb_getmonmode.sh                 |    7 ++++---
 tests/simple/21_ctdb_disablemonitor.sh             |    2 +-
 tests/simple/22_ctdb_enablemonitor.sh              |    7 +++++--
 tests/simple/23_ctdb_moveip.sh                     |    6 +++---
 tests/simple/24_ctdb_getdbmap.sh                   |    6 +++---
 ..._ctdb_config_check_error_on_unreachable_ctdb.sh |    4 +---
 11 files changed, 43 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/tests/scripts/ctdb_test_functions.bash b/tests/scripts/ctdb_test_functions.bash
index 1930ae1..210e6c4 100644
--- a/tests/scripts/ctdb_test_functions.bash
+++ b/tests/scripts/ctdb_test_functions.bash
@@ -591,6 +591,10 @@ setup_ctdb ()
 
 restart_ctdb ()
 {
+    if [ "$1" = "-v" ] ; then
+	echo "Restarting CTDB (scheduled)..."
+    fi
+    
     if [ -n "$CTDB_NODES_SOCKETS" ] ; then
 	daemons_stop
 	daemons_start $CTDB_TEST_NUM_DAEMONS
@@ -615,6 +619,13 @@ restart_ctdb ()
     echo "ctdb is ready"
 }
 
+ctdb_restart_when_done ()
+{
+    ctdb_test_exit_hook_add restart_ctdb -v
+}
+
+
+
 #######################################
 
 install_eventscript ()
diff --git a/tests/simple/04_ctdb_setvar.sh b/tests/simple/04_ctdb_setvar.sh
index 9348308..ceb6c23 100755
--- a/tests/simple/04_ctdb_setvar.sh
+++ b/tests/simple/04_ctdb_setvar.sh
@@ -38,6 +38,9 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
+# Reset configuration
+ctdb_restart_when_done
+
 var="RecoverTimeout"
 
 try_command_on_node -v 0 $CTDB getvar $var
@@ -67,8 +70,7 @@ try_command_on_node -v 0 "$CTDB listvars | grep '^$var'"
 check="${out#*= }"
 
 if [ "$incr" != "$check" ] ; then
-    echo "Nope, that didn't work.  Restarting ctdb to get back into known state..."
-    restart_ctdb
+    echo "Nope, that didn't work..."
     exit 1
 fi
 
diff --git a/tests/simple/16_ctdb_config_add_ip.sh b/tests/simple/16_ctdb_config_add_ip.sh
index 50fc9c5..634a39a 100755
--- a/tests/simple/16_ctdb_config_add_ip.sh
+++ b/tests/simple/16_ctdb_config_add_ip.sh
@@ -42,6 +42,9 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
+# Reset configuration
+ctdb_restart_when_done
+
 echo "Getting list of public IPs..."
 try_command_on_node 0 "$CTDB ip -n all | sed -e '1d'"
 
@@ -112,7 +115,4 @@ else
     testfailures=1
 fi
 
-echo "Restarting cluster to restore configuration..."
-restart_ctdb
-
 ctdb_test_exit
diff --git a/tests/simple/17_ctdb_config_delete_ip.sh b/tests/simple/17_ctdb_config_delete_ip.sh
index 822c702..bab45dd 100755
--- a/tests/simple/17_ctdb_config_delete_ip.sh
+++ b/tests/simple/17_ctdb_config_delete_ip.sh
@@ -38,6 +38,9 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
+# Reset configuration
+ctdb_restart_when_done
+
 echo "Getting list of public IPs..."
 try_command_on_node -v 0 "$CTDB ip -n all | sed -e '1d'"
 
@@ -65,8 +68,7 @@ while read ip pnn ; do
 done <<<"$out" # bashism to avoid problem setting variable in pipeline.
 
 if [ "${test_node_ips/${ip_to_remove}}" = "$test_node_ips" ] ; then
-    echo "That worked!  Restarting cluster to restore configuration..."
-    restart_ctdb
+    echo "GOOD: That worked!"
 else
     echo "BAD: The remove IP address is still there!"
     testfailures=1
diff --git a/tests/simple/18_ctdb_freeze.sh b/tests/simple/18_ctdb_freeze.sh
index 5f2ccb0..009e2a7 100755
--- a/tests/simple/18_ctdb_freeze.sh
+++ b/tests/simple/18_ctdb_freeze.sh
@@ -36,6 +36,9 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
+# Reset configuration
+ctdb_restart_when_done
+
 test_node=1
 
 echo "Freezing node $test_node"
@@ -44,8 +47,6 @@ try_command_on_node 0 $CTDB freeze -n $test_node
 
 onnode 0 $CTDB_TEST_WRAPPER wait_until_node_has_status $test_node frozen
 
-echo "That worked!  Restarting cluster to restore configuration..."
-
-restart_ctdb
+echo "GOOD: That worked!"
 
 ctdb_test_exit
diff --git a/tests/simple/20_ctdb_getmonmode.sh b/tests/simple/20_ctdb_getmonmode.sh
index 802f302..6a55341 100755
--- a/tests/simple/20_ctdb_getmonmode.sh
+++ b/tests/simple/20_ctdb_getmonmode.sh
@@ -38,6 +38,9 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
+# Reset configuration
+ctdb_restart_when_done
+
 test_node=1
 
 try_command_on_node -v 0 $CTDB getmonmode -n $test_node
@@ -62,8 +65,6 @@ try_command_on_node -v 0 $CTDB disablemonitor -n $test_node
 
 onnode 0 $CTDB_TEST_WRAPPER wait_until_node_has_status $test_node monoff
 
-echo "That worked!  Restarting cluster to restore configuration..."
-
-restart_ctdb
+echo "GOOD: That worked!"
 
 ctdb_test_exit
diff --git a/tests/simple/21_ctdb_disablemonitor.sh b/tests/simple/21_ctdb_disablemonitor.sh
index 85855e4..23ae052 100755
--- a/tests/simple/21_ctdb_disablemonitor.sh
+++ b/tests/simple/21_ctdb_disablemonitor.sh
@@ -57,7 +57,7 @@ detected="/tmp/ctdb-test-unhealthy-detected.${test_node}"
 recovered_flag="/tmp/ctdb-test-flag.recovered.${test_node}"
 try_command_on_node $test_node touch "$recovered_flag"
 
-ctdb_test_exit_hook="onnode $test_node rm -vf $trigger"
+ctdb_test_exit_hook_add "onnode $test_node rm -vf $trigger"
 
 echo "Creating trigger file on node $test_node to make it unhealthy..."
 try_command_on_node $test_node touch "$trigger"
diff --git a/tests/simple/22_ctdb_enablemonitor.sh b/tests/simple/22_ctdb_enablemonitor.sh
index f7d6809..98fc7e2 100755
--- a/tests/simple/22_ctdb_enablemonitor.sh
+++ b/tests/simple/22_ctdb_enablemonitor.sh
@@ -42,6 +42,9 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
+# Reset configuration
+ctdb_restart_when_done
+
 test_node=1
 
 # We need this for later, so we know how long to sleep.
@@ -64,7 +67,7 @@ detected="/tmp/ctdb-test-unhealthy-detected.${test_node}"
 recovered_flag="/tmp/ctdb-test-flag.recovered.${test_node}"
 try_command_on_node $test_node touch "$recovered_flag"
 
-ctdb_test_exit_hook="onnode $test_node rm -vf $trigger; restart_ctdb"
+ctdb_test_exit_hook_add "onnode $test_node rm -vf $trigger"
 
 echo "Creating trigger file on node $test_node to see if it goes unhealthy..."
 try_command_on_node $test_node touch "$trigger"
@@ -96,6 +99,6 @@ onnode 0 $CTDB_TEST_WRAPPER wait_until_node_has_status $test_node unhealthy $mon
 
 try_command_on_node -v $test_node ls -l "$detected"
 
-echo "OK, that all worked.  Expect a restart..."
+echo "GOOD: That all worked..."
 
 ctdb_test_exit
diff --git a/tests/simple/23_ctdb_moveip.sh b/tests/simple/23_ctdb_moveip.sh
index c91bbbe..ca7fe11 100755
--- a/tests/simple/23_ctdb_moveip.sh
+++ b/tests/simple/23_ctdb_moveip.sh
@@ -37,8 +37,8 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
-# Restart when done since things are likely to be broken.
-ctdb_test_exit_hook="restart_ctdb"
+# Reset configuration
+ctdb_restart_when_done
 
 try_command_on_node 0 "$CTDB listnodes | wc -l"
 num_nodes="$out"
@@ -100,6 +100,6 @@ else
     exit 1
 fi
 
-echo "OK, that worked... expect a restart..."
+echo "GOOD: That worked..."
 
 ctdb_test_exit
diff --git a/tests/simple/24_ctdb_getdbmap.sh b/tests/simple/24_ctdb_getdbmap.sh
index 49ebda0..c621a30 100755
--- a/tests/simple/24_ctdb_getdbmap.sh
+++ b/tests/simple/24_ctdb_getdbmap.sh
@@ -31,8 +31,8 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
-# Restart when done since things are likely to be broken.
-ctdb_test_exit_hook="restart_ctdb"
+# Reset configuration
+ctdb_restart_when_done
 
 make_temp_db_filename ()
 {
@@ -70,6 +70,6 @@ for i in $(seq 1 5) ; do
     fi
 done
 
-echo "OK, that worked... expect a restart..."
+echo "GOOD: That worked..."
 
 ctdb_test_exit
diff --git a/tests/simple/26_ctdb_config_check_error_on_unreachable_ctdb.sh b/tests/simple/26_ctdb_config_check_error_on_unreachable_ctdb.sh
index 72e0acd..4287cba 100755
--- a/tests/simple/26_ctdb_config_check_error_on_unreachable_ctdb.sh
+++ b/tests/simple/26_ctdb_config_check_error_on_unreachable_ctdb.sh
@@ -64,8 +64,6 @@ for i in ip disable enable "ban 0" unban listvars ; do
     fi
 done
 
-echo "That all looks OK.  Restarting cluster..."
-
-restart_ctdb
+echo "OK, that all worked.  Expect a restart..."
 
 ctdb_test_exit


-- 
CTDB repository


More information about the samba-cvs mailing list