if [ "${out/SRC: ${src_socket} /}" != "$out" ] ; then
echo "GOOD: CIFS connection tracked OK by CTDB."
else
- echo "BAD: Socket not tracked by CTDB."
- testfailures=1
+ die "BAD: Socket not tracked by CTDB."
fi
# This is almost immediate. However, it is sent between nodes
if [ "$original_mac" != "$new_mac" ] ; then
echo "GOOD: MAC address changed"
else
- echo "BAD: MAC address did not change"
- testfailures=1
+ die "BAD: MAC address did not change"
fi
if [ "$original_hostname" != "$new_hostname" ] ; then
echo "GOOD: hostname changed"
else
- echo "BAD: hostname did not change"
- testfailures=1
+ die "BAD: hostname did not change"
fi
if [ "$original_md5" = "$new_md5" ] ; then
echo "GOOD: file contents unchanged after failover"
else
- echo "BAD: file contents are different after failover"
- testfailures=1
+ die "BAD: file contents are different after failover"
fi
if [ "$original_md5" = "$new_md5" ] ; then
echo "GOOD: file contents unchanged after failover"
else
- echo "BAD: file contents are different after failover"
- testfailures=1
+ die "BAD: file contents are different after failover"
fi
trap - 0
- [ $(($testfailures+0)) -eq 0 -a $status -ne 0 ] && testfailures=$status
- status=$(($testfailures+0))
-
# Avoid making a test fail from this point onwards. The test is
# now complete.
set +e
ctdb_test_init ()
{
scriptname=$(basename "$0")
- testfailures=0
ctdb_test_restart_scheduled=false
trap "ctdb_test_exit" 0
else
echo "DIFFERs from node 0:"
echo "$out"
- testfailures=1
+ exit 1
fi
n=$(($n + 1))
done
if [ "$pids_onnode" = "$pids_getpid_n" ] ; then
echo "They're the same... cool!"
else
- echo "Error: they differ."
- testfailures=1
+ die "Error: they differ."
fi
echo "Checking each PID for validity"
# We could check cmdline too if this isn't good enough.
echo "GOOD enough!"
else
- echo "BAD!"
- testfailures=1
+ die "BAD!"
fi
n=$(($n + 1))
done <<<"$pids_onnode"
if [ $status -eq 0 ] ; then
echo "OK"
else
- echo "BAD"
- testfailures=1
+ die "BAD"
fi
echo "Checking for PID $client_pid with SRVID $srvid on node $test_node"
if [ $status -eq 0 ] ; then
echo "OK"
else
- echo "BAD"
- testfailures=1
+ die "BAD"
fi
echo "Checking for PID $client_pid with SRVID $client_pid on node $test_node"
if [ $num_rm_lines -eq 1 ] ; then
echo "OK, there is only 1 recmaster"
else
- echo "BAD, there are ${num_rm_lines} nodes claiming to be the recmaster"
- testfailures=1
+ die "BAD, there are ${num_rm_lines} nodes claiming to be the recmaster"
fi
if [ $(($num_all_lines - $num_not_rm_lines)) -eq 1 ] ; then
echo "OK, all the other nodes claim not to be the recmaster"
else
- echo "BAD, there are only ${num_not_rm_lines} nodes claiming not to be the recmaster"
- testfailures=1
+ die "BAD, there are only ${num_not_rm_lines} notrecmaster nodes"
fi
-e 's@\]@@g')
if [ -z "$TEST_LOCAL_DAEMONS" ]; then
- while read ip pnn ; do
- try_command_on_node $pnn "ip addr show"
- if [ "${out/inet* ${ip}\/}" != "$out" ] ; then
- echo "GOOD: node $pnn appears to have $ip assigned"
- else
- echo "BAD: node $pnn does not appear to have $ip assigned"
- testfailures=1
- fi
- done <<<"$ips" # bashism to avoid problem setting variable in pipeline.
+ while read ip pnn ; do
+ try_command_on_node $pnn "ip addr show"
+ if [ "${out/inet* ${ip}\/}" != "$out" ] ; then
+ echo "GOOD: node $pnn appears to have $ip assigned"
+ else
+ die "BAD: node $pnn does not appear to have $ip assigned"
+ fi
+ done <<<"$ips" # bashism to avoid problem setting variable in pipeline.
fi
-[ "$testfailures" != 1 ] && echo "Looks good!"
+echo "Looks good!"
cmd="$CTDB -X ip all | tail -n +2"
echo "Checking that \"$cmd\" produces expected output..."
echo "$out"
echo "Should be like this:"
echo "$machineout"
- testfailures=1
+ exit 1
fi
if [ "$getdebug_onnode" = "$getdebug_n" ] ; then
echo "They're the same... cool!"
else
- echo "Error: they differ."
- testfailures=1
+ die "Error: they differ."
fi
seps=""
cluster_is_healthy
+ctdb_restart_when_done
+
select_test_node_and_ips
get_debug ()
get_debug $node
if [ "$levelstr" != "$check_debug" ] ; then
- echo "BAD: Debug level should have changed to \"$levelstr\" but it is \"$check_debug\"."
- testfailures=1
+ die "BAD: Debug level \"$levelstr\" != \"$check_debug\"."
fi
}
INFO 9
DEBUG 10
EOF
-
-if [ "$testfailures" != 1 ] ; then
- echo
- echo "Returning the debug level to its initial value..."
- set_and_check_debug $test_node "$initial_debug"
-fi
if [ $after -lt $before ] ; then
echo "GOOD: ${label} reduced from ${before} to ${after}"
else
- echo "BAD: ${label} did not reduce from ${before} to ${after}"
- testfailures=1
+ die "BAD: ${label} did not reduce from ${before} to ${after}"
fi
}