2008-11-20 12:40:01 +03:00
#!/bin/bash
2008-11-24 09:47:09 +03:00
test_info( )
{
cat <<EOF
Verify the operation of 'ctdb isnotrecmaster' .
Prerequisites:
* An active CTDB cluster with at least 2 active nodes.
Steps:
1. Verify that the status on all of the ctdb nodes is 'OK' .
2. Run 'ctdb isnotrecmaster' on each node.
3. Verify that only 1 node shows the output ' This node is the
recmaster' and all the other nodes show the output ' This node is
not the recmaster' .
Expected results:
* 'ctdb isnotrecmaster' shows the correct output.
EOF
}
2012-04-18 08:55:21 +04:00
. " ${ TEST_SCRIPTS_DIR } /integration.bash "
2008-11-20 12:40:01 +03:00
2018-10-08 07:04:24 +03:00
ctdb_test_init
2008-11-24 09:47:09 +03:00
2008-11-20 12:40:01 +03:00
set -e
2009-07-06 11:52:11 +04:00
cluster_is_healthy
2008-11-20 12:40:01 +03:00
2009-01-08 09:12:03 +03:00
cmd = " $CTDB isnotrecmaster || true "
2019-04-11 13:55:20 +03:00
try_command_on_node -v all " $cmd "
2008-11-20 12:40:01 +03:00
2019-04-11 13:55:20 +03:00
num_all_lines = $( wc -l <" $outfile " )
num_rm_lines = $( grep -Fc 'this node is the recmaster' " $outfile " ) || true
num_not_rm_lines = $( grep -Fc 'this node is not the recmaster' " $outfile " ) || true
2008-11-20 12:40:01 +03:00
if [ $num_rm_lines -eq 1 ] ; then
echo "OK, there is only 1 recmaster"
else
2018-10-08 04:59:33 +03:00
die " BAD, there are ${ num_rm_lines } nodes claiming to be the recmaster "
2008-11-20 12:40:01 +03:00
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
2018-10-08 04:59:33 +03:00
die " BAD, there are only ${ num_not_rm_lines } notrecmaster nodes "
2008-11-20 12:40:01 +03:00
fi