From bafb9151ccb5722df36f9ba168716f4f4fa01cdc Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 28 Feb 2014 15:54:05 +1100 Subject: ctdb-tests: Improve tickle tests It is hard to diagnose failures in the NFS tickle test because there's no way of telling if the test node doesn't have the tickle or if it didn't get propagated. Factor out check_tickles() into local.bash and give it some parameters. Have the NFS test call it first to ensure the tickle has been registered. Then use new function check_tickles_all() to ensure the tickle has been propagated to all nodes. Give this a bit of extra time (double the timeout) just in case we're racing with the update. Add a useful comment to the CIFS test so that I stop asking myself how the test could ever have worked reliably. :-) Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs Pair-programmed-with: Amitay Isaacs --- ctdb/tests/complex/scripts/local.bash | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'ctdb/tests/complex/scripts') diff --git a/ctdb/tests/complex/scripts/local.bash b/ctdb/tests/complex/scripts/local.bash index eb4c41c8b6..6fbc1aea71 100644 --- a/ctdb/tests/complex/scripts/local.bash +++ b/ctdb/tests/complex/scripts/local.bash @@ -27,6 +27,35 @@ wait_until_get_src_socket () wait_until 5 get_src_socket "$@" } +####################################### + +check_tickles () +{ + local node="$1" + local test_ip="$2" + local test_port="$3" + local src_socket="$4" + try_command_on_node $node ctdb gettickles $test_ip $test_port + # SRC: 10.0.2.45:49091 DST: 10.0.2.143:445 + [ "${out/SRC: ${src_socket} /}" != "$out" ] +} + +check_tickles_all () +{ + local numnodes="$1" + local test_ip="$2" + local test_port="$3" + local src_socket="$4" + + try_command_on_node all ctdb gettickles $test_ip $test_port + # SRC: 10.0.2.45:49091 DST: 10.0.2.143:445 + local t="${src_socket//./\\.}" + local count=$(grep -E -c "SRC: ${t} " <<<"$out" || true) + [ $count -eq $numnodes ] +} + + + ####################################### # filename will be in $tcpdump_filename, pid in $tcpdump_pid -- cgit