From: Martin Schwenke Date: Tue, 7 May 2019 05:42:49 +0000 (+1000) Subject: ctdb-tests: Fix logic error in simple ctdb reloadips test X-Git-Tag: tdb-1.4.1~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc89db8ca6aadd4a9f7e8a85843c53709d04587c;p=thirdparty%2Fsamba.git ctdb-tests: Fix logic error in simple ctdb reloadips test There is a chance that restoring IP addresses to the test node will result in different IP addresses being assigned to that node. Removing a single IP address may then fail (or be a no-op) if it is done after the restore. So, swap the single IP address removal to happen first, then restore, then remove all IP addresses. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/simple/18_ctdb_reloadips.sh b/ctdb/tests/simple/18_ctdb_reloadips.sh index 61c3a561da9..451fca3a866 100755 --- a/ctdb/tests/simple/18_ctdb_reloadips.sh +++ b/ctdb/tests/simple/18_ctdb_reloadips.sh @@ -29,8 +29,6 @@ cluster_is_healthy select_test_node_and_ips -echo "Emptying public addresses file on $test_node" - try_command_on_node $test_node $CTDB_TEST_WRAPPER ctdb_base_show addresses="${out}/public_addresses" echo "Public addresses file on node $test_node is \"$addresses\"" @@ -69,25 +67,31 @@ do_ctdb_reloadips () done } -try_command_on_node $test_node "mv $addresses $backup && touch $addresses" + +echo "Removing IP $test_ip from node $test_node" + +try_command_on_node $test_node "mv $addresses $backup && grep -v '^${test_ip}/' $backup >$addresses" do_ctdb_reloadips -echo "Getting list of public IPs on node $test_node" -try_command_on_node $test_node "$CTDB ip | tail -n +2" +try_command_on_node $test_node $CTDB ip -if [ -n "$out" ] ; then +if grep "^${test_ip} " <<<"$out" ; then cat <$addresses" +echo "Emptying public addresses file on $test_node" + +try_command_on_node $test_node "mv $addresses $backup && touch $addresses" do_ctdb_reloadips -try_command_on_node $test_node $CTDB ip +echo "Getting list of public IPs on node $test_node" +try_command_on_node $test_node "$CTDB ip | tail -n +2" -if grep "^${test_ip} " <<<"$out" ; then +if [ -n "$out" ] ; then cat <