From 8a5c4a60e156170f8aaa738672ed6dc50712a929 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 9 Sep 2019 16:00:52 +1000 Subject: ctdb-tests: Move simple tests to INTEGRATION/ subdirectory Split some tests out into database/ and failover/ subdirectories. Rename the remaining tests in simple/. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- .../INTEGRATION/database/basics.001.attach.sh | 68 +++++++ .../INTEGRATION/database/basics.002.attach.sh | 135 ++++++++++++++ .../INTEGRATION/database/basics.003.detach.sh | 185 +++++++++++++++++++ ctdb/tests/INTEGRATION/database/basics.004.wipe.sh | 75 ++++++++ .../database/basics.010.backup_restore.sh | 118 +++++++++++++ ctdb/tests/INTEGRATION/database/fetch.001.ring.sh | 44 +++++ .../INTEGRATION/database/readonly.001.basic.sh | 196 +++++++++++++++++++++ .../INTEGRATION/database/recovery.001.volatile.sh | 130 ++++++++++++++ .../INTEGRATION/database/recovery.002.large.sh | 124 +++++++++++++ .../database/recovery.003.no_resurrect.sh | 76 ++++++++ .../database/recovery.010.persistent.sh | 122 +++++++++++++ .../INTEGRATION/database/recovery.011.continue.sh | 86 +++++++++ .../INTEGRATION/database/transaction.001.ptrans.sh | 127 +++++++++++++ .../INTEGRATION/database/transaction.002.loop.sh | 39 ++++ .../database/transaction.003.loop_recovery.sh | 61 +++++++ .../database/transaction.004.update_record.sh | 97 ++++++++++ .../database/transaction.010.loop_recovery.sh | 62 +++++++ .../tests/INTEGRATION/database/traverse.001.one.sh | 128 ++++++++++++++ .../INTEGRATION/database/traverse.002.many.sh | 70 ++++++++ ctdb/tests/INTEGRATION/failover/pubips.001.list.sh | 71 ++++++++ .../tests/INTEGRATION/failover/pubips.010.addip.sh | 35 ++++ .../tests/INTEGRATION/failover/pubips.011.delip.sh | 26 +++ .../INTEGRATION/failover/pubips.012.reloadips.sh | 133 ++++++++++++++ .../failover/pubips.013.failover_noop.sh | 52 ++++++ .../INTEGRATION/failover/pubips.014.iface_gc.sh | 58 ++++++ .../INTEGRATION/failover/pubips.020.moveip.sh | 80 +++++++++ .../failover/pubips.030.disable_enable.sh | 30 ++++ .../failover/pubips.032.stop_continue.sh | 28 +++ .../failover/pubips.040.NoIPTakeover.sh | 80 +++++++++ .../INTEGRATION/failover/pubips.050.missing_ip.sh | 78 ++++++++ ctdb/tests/INTEGRATION/simple/README | 2 + ctdb/tests/INTEGRATION/simple/basics.000.onnode.sh | 29 +++ .../INTEGRATION/simple/basics.001.listnodes.sh | 60 +++++++ .../INTEGRATION/simple/basics.002.tunables.sh | 74 ++++++++ ctdb/tests/INTEGRATION/simple/basics.003.ping.sh | 52 ++++++ ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh | 77 ++++++++ .../simple/basics.005.process_exists.sh | 90 ++++++++++ .../INTEGRATION/simple/basics.010.statistics.sh | 38 ++++ .../simple/basics.011.statistics_reset.sh | 83 +++++++++ .../simple/cluster.001.isnotrecmaster.sh | 52 ++++++ .../simple/cluster.002.recmaster_yield.sh | 51 ++++++ .../INTEGRATION/simple/cluster.010.getrelock.sh | 34 ++++ .../simple/cluster.012.reclock_command.sh | 28 +++ .../INTEGRATION/simple/cluster.020.message_ring.sh | 64 +++++++ .../INTEGRATION/simple/cluster.021.tunnel_ring.sh | 45 +++++ .../INTEGRATION/simple/cluster.090.unreachable.sh | 67 +++++++ .../simple/cluster.091.version_check.sh | 65 +++++++ .../tests/INTEGRATION/simple/debug.001.getdebug.sh | 62 +++++++ .../tests/INTEGRATION/simple/debug.002.setdebug.sh | 81 +++++++++ .../INTEGRATION/simple/debug.003.dumpmemory.sh | 38 ++++ .../simple/eventscripts.001.zero_scripts.sh | 26 +++ .../simple/eventscripts.090.debug_hung.sh | 89 ++++++++++ ctdb/tests/run_tests.sh | 8 +- ctdb/tests/simple/00_ctdb_onnode.sh | 29 --- ctdb/tests/simple/01_ctdb_reclock_command.sh | 28 --- ctdb/tests/simple/02_ctdb_tunables.sh | 74 -------- ctdb/tests/simple/05_ctdb_listnodes.sh | 60 ------- ctdb/tests/simple/06_ctdb_getpid.sh | 77 -------- ctdb/tests/simple/07_ctdb_process_exists.sh | 90 ---------- ctdb/tests/simple/08_ctdb_isnotrecmaster.sh | 52 ------ ctdb/tests/simple/09_ctdb_ping.sh | 52 ------ ctdb/tests/simple/11_ctdb_ip.sh | 71 -------- ctdb/tests/simple/12_ctdb_getdebug.sh | 62 ------- ctdb/tests/simple/13_ctdb_setdebug.sh | 81 --------- ctdb/tests/simple/14_ctdb_statistics.sh | 38 ---- ctdb/tests/simple/15_ctdb_statisticsreset.sh | 83 --------- ctdb/tests/simple/16_ctdb_config_add_ip.sh | 35 ---- ctdb/tests/simple/17_ctdb_config_delete_ip.sh | 26 --- ctdb/tests/simple/18_ctdb_reloadips.sh | 133 -------------- ctdb/tests/simple/19_ip_takeover_noop.sh | 52 ------ ctdb/tests/simple/20_delip_iface_gc.sh | 58 ------ ctdb/tests/simple/21_ctdb_attach.sh | 135 -------------- ctdb/tests/simple/23_ctdb_moveip.sh | 80 --------- ctdb/tests/simple/24_ctdb_getdbmap.sh | 68 ------- ctdb/tests/simple/25_dumpmemory.sh | 38 ---- ..._ctdb_config_check_error_on_unreachable_ctdb.sh | 67 ------- ctdb/tests/simple/27_ctdb_detach.sh | 185 ------------------- ctdb/tests/simple/28_zero_eventscripts.sh | 26 --- ctdb/tests/simple/32_ctdb_disable_enable.sh | 30 ---- ctdb/tests/simple/35_ctdb_getreclock.sh | 34 ---- ctdb/tests/simple/42_ctdb_stop_continue.sh | 28 --- ctdb/tests/simple/43_stop_recmaster_yield.sh | 51 ------ ctdb/tests/simple/51_message_ring.sh | 64 ------- ctdb/tests/simple/52_fetch_ring.sh | 44 ----- ctdb/tests/simple/53_transaction_loop.sh | 39 ---- ctdb/tests/simple/54_transaction_loop_recovery.sh | 61 ------- ctdb/tests/simple/55_ctdb_ptrans.sh | 127 ------------- .../simple/56_replicated_transaction_recovery.sh | 62 ------- ctdb/tests/simple/58_ctdb_restoredb.sh | 118 ------------- ctdb/tests/simple/60_recoverd_missing_ip.sh | 78 -------- ctdb/tests/simple/69_recovery_resurrect_deleted.sh | 76 -------- ctdb/tests/simple/70_recoverpdbbyseqnum.sh | 122 ------------- ctdb/tests/simple/71_ctdb_wipedb.sh | 75 -------- ctdb/tests/simple/72_update_record_persistent.sh | 97 ---------- ctdb/tests/simple/73_tunable_NoIPTakeover.sh | 80 --------- ctdb/tests/simple/75_readonly_records_basic.sh | 196 --------------------- ctdb/tests/simple/76_ctdb_pdb_recovery.sh | 86 --------- ctdb/tests/simple/77_ctdb_db_recovery.sh | 130 -------------- ctdb/tests/simple/78_ctdb_large_db_recovery.sh | 124 ------------- ctdb/tests/simple/79_volatile_db_traverse.sh | 128 -------------- ctdb/tests/simple/80_ctdb_traverse.sh | 70 -------- ctdb/tests/simple/81_tunnel_ring.sh | 45 ----- ctdb/tests/simple/90_debug_hung_script.sh | 89 ---------- ctdb/tests/simple/91_version_check.sh | 65 ------- ctdb/tests/simple/README | 2 - ctdb/wscript | 4 +- 106 files changed, 3827 insertions(+), 3827 deletions(-) create mode 100755 ctdb/tests/INTEGRATION/database/basics.001.attach.sh create mode 100755 ctdb/tests/INTEGRATION/database/basics.002.attach.sh create mode 100755 ctdb/tests/INTEGRATION/database/basics.003.detach.sh create mode 100755 ctdb/tests/INTEGRATION/database/basics.004.wipe.sh create mode 100755 ctdb/tests/INTEGRATION/database/basics.010.backup_restore.sh create mode 100755 ctdb/tests/INTEGRATION/database/fetch.001.ring.sh create mode 100755 ctdb/tests/INTEGRATION/database/readonly.001.basic.sh create mode 100755 ctdb/tests/INTEGRATION/database/recovery.001.volatile.sh create mode 100755 ctdb/tests/INTEGRATION/database/recovery.002.large.sh create mode 100755 ctdb/tests/INTEGRATION/database/recovery.003.no_resurrect.sh create mode 100755 ctdb/tests/INTEGRATION/database/recovery.010.persistent.sh create mode 100755 ctdb/tests/INTEGRATION/database/recovery.011.continue.sh create mode 100755 ctdb/tests/INTEGRATION/database/transaction.001.ptrans.sh create mode 100755 ctdb/tests/INTEGRATION/database/transaction.002.loop.sh create mode 100755 ctdb/tests/INTEGRATION/database/transaction.003.loop_recovery.sh create mode 100755 ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh create mode 100755 ctdb/tests/INTEGRATION/database/transaction.010.loop_recovery.sh create mode 100755 ctdb/tests/INTEGRATION/database/traverse.001.one.sh create mode 100755 ctdb/tests/INTEGRATION/database/traverse.002.many.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.001.list.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.010.addip.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.011.delip.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.012.reloadips.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.014.iface_gc.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.030.disable_enable.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.032.stop_continue.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh create mode 100755 ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh create mode 100644 ctdb/tests/INTEGRATION/simple/README create mode 100755 ctdb/tests/INTEGRATION/simple/basics.000.onnode.sh create mode 100755 ctdb/tests/INTEGRATION/simple/basics.001.listnodes.sh create mode 100755 ctdb/tests/INTEGRATION/simple/basics.002.tunables.sh create mode 100755 ctdb/tests/INTEGRATION/simple/basics.003.ping.sh create mode 100755 ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh create mode 100755 ctdb/tests/INTEGRATION/simple/basics.005.process_exists.sh create mode 100755 ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh create mode 100755 ctdb/tests/INTEGRATION/simple/basics.011.statistics_reset.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.001.isnotrecmaster.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.002.recmaster_yield.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.010.getrelock.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.012.reclock_command.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.020.message_ring.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.021.tunnel_ring.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.090.unreachable.sh create mode 100755 ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh create mode 100755 ctdb/tests/INTEGRATION/simple/debug.001.getdebug.sh create mode 100755 ctdb/tests/INTEGRATION/simple/debug.002.setdebug.sh create mode 100755 ctdb/tests/INTEGRATION/simple/debug.003.dumpmemory.sh create mode 100755 ctdb/tests/INTEGRATION/simple/eventscripts.001.zero_scripts.sh create mode 100755 ctdb/tests/INTEGRATION/simple/eventscripts.090.debug_hung.sh delete mode 100755 ctdb/tests/simple/00_ctdb_onnode.sh delete mode 100755 ctdb/tests/simple/01_ctdb_reclock_command.sh delete mode 100755 ctdb/tests/simple/02_ctdb_tunables.sh delete mode 100755 ctdb/tests/simple/05_ctdb_listnodes.sh delete mode 100755 ctdb/tests/simple/06_ctdb_getpid.sh delete mode 100755 ctdb/tests/simple/07_ctdb_process_exists.sh delete mode 100755 ctdb/tests/simple/08_ctdb_isnotrecmaster.sh delete mode 100755 ctdb/tests/simple/09_ctdb_ping.sh delete mode 100755 ctdb/tests/simple/11_ctdb_ip.sh delete mode 100755 ctdb/tests/simple/12_ctdb_getdebug.sh delete mode 100755 ctdb/tests/simple/13_ctdb_setdebug.sh delete mode 100755 ctdb/tests/simple/14_ctdb_statistics.sh delete mode 100755 ctdb/tests/simple/15_ctdb_statisticsreset.sh delete mode 100755 ctdb/tests/simple/16_ctdb_config_add_ip.sh delete mode 100755 ctdb/tests/simple/17_ctdb_config_delete_ip.sh delete mode 100755 ctdb/tests/simple/18_ctdb_reloadips.sh delete mode 100755 ctdb/tests/simple/19_ip_takeover_noop.sh delete mode 100755 ctdb/tests/simple/20_delip_iface_gc.sh delete mode 100755 ctdb/tests/simple/21_ctdb_attach.sh delete mode 100755 ctdb/tests/simple/23_ctdb_moveip.sh delete mode 100755 ctdb/tests/simple/24_ctdb_getdbmap.sh delete mode 100755 ctdb/tests/simple/25_dumpmemory.sh delete mode 100755 ctdb/tests/simple/26_ctdb_config_check_error_on_unreachable_ctdb.sh delete mode 100755 ctdb/tests/simple/27_ctdb_detach.sh delete mode 100755 ctdb/tests/simple/28_zero_eventscripts.sh delete mode 100755 ctdb/tests/simple/32_ctdb_disable_enable.sh delete mode 100755 ctdb/tests/simple/35_ctdb_getreclock.sh delete mode 100755 ctdb/tests/simple/42_ctdb_stop_continue.sh delete mode 100755 ctdb/tests/simple/43_stop_recmaster_yield.sh delete mode 100755 ctdb/tests/simple/51_message_ring.sh delete mode 100755 ctdb/tests/simple/52_fetch_ring.sh delete mode 100755 ctdb/tests/simple/53_transaction_loop.sh delete mode 100755 ctdb/tests/simple/54_transaction_loop_recovery.sh delete mode 100755 ctdb/tests/simple/55_ctdb_ptrans.sh delete mode 100755 ctdb/tests/simple/56_replicated_transaction_recovery.sh delete mode 100755 ctdb/tests/simple/58_ctdb_restoredb.sh delete mode 100755 ctdb/tests/simple/60_recoverd_missing_ip.sh delete mode 100755 ctdb/tests/simple/69_recovery_resurrect_deleted.sh delete mode 100755 ctdb/tests/simple/70_recoverpdbbyseqnum.sh delete mode 100755 ctdb/tests/simple/71_ctdb_wipedb.sh delete mode 100755 ctdb/tests/simple/72_update_record_persistent.sh delete mode 100755 ctdb/tests/simple/73_tunable_NoIPTakeover.sh delete mode 100755 ctdb/tests/simple/75_readonly_records_basic.sh delete mode 100755 ctdb/tests/simple/76_ctdb_pdb_recovery.sh delete mode 100755 ctdb/tests/simple/77_ctdb_db_recovery.sh delete mode 100755 ctdb/tests/simple/78_ctdb_large_db_recovery.sh delete mode 100755 ctdb/tests/simple/79_volatile_db_traverse.sh delete mode 100755 ctdb/tests/simple/80_ctdb_traverse.sh delete mode 100755 ctdb/tests/simple/81_tunnel_ring.sh delete mode 100755 ctdb/tests/simple/90_debug_hung_script.sh delete mode 100755 ctdb/tests/simple/91_version_check.sh delete mode 100644 ctdb/tests/simple/README diff --git a/ctdb/tests/INTEGRATION/database/basics.001.attach.sh b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh new file mode 100755 index 00000000000..32d6d26a4ff --- /dev/null +++ b/ctdb/tests/INTEGRATION/database/basics.001.attach.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +test_info() +{ + cat </dev/null | + md5sum | + awk '{printf "%s.tdb\n", $1}' +} + +try_command_on_node -v 0 "$CTDB getdbmap" + +db_map_pattern='^(Number of databases:[[:digit:]]+|dbid:0x[[:xdigit:]]+ name:[^[:space:]]+ path:[^[:space:]]+)$' + +sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern" + +num_db_init=$(sed -n -e '1s/.*://p' "$outfile") + +for i in $(seq 1 5) ; do + f=$(make_temp_db_filename) + echo "Creating test database: $f" + try_command_on_node 0 $CTDB attach "$f" + try_command_on_node 0 $CTDB getdbmap + sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern" + num=$(sed -n -e '1s/^.*://p' "$outfile") + if [ $num = $(($num_db_init + $i)) ] ; then + echo "OK: correct number of additional databases" + else + echo "BAD: no additional database" + exit 1 + fi + if awk '{print $2}' "$outfile" | grep -Fqx "name:$f" ; then + echo "OK: getdbmap knows about \"$f\"" + else + echo "BAD: getdbmap does not know about \"$f\"" + exit 1 + fi +done diff --git a/ctdb/tests/INTEGRATION/database/basics.002.attach.sh b/ctdb/tests/INTEGRATION/database/basics.002.attach.sh new file mode 100755 index 00000000000..b9ae9481d91 --- /dev/null +++ b/ctdb/tests/INTEGRATION/database/basics.002.attach.sh @@ -0,0 +1,135 @@ +#!/bin/bash + +test_info() +{ + cat </dev/null ; then + return 0 + else + return 1 + fi +} + +check_db () +{ + local pnn="$1" + local db="$2" + local flag="$3" + + local flags + + echo "Waiting until database ${db} is attached on node ${pnn}" + wait_until 10 check_db_once "$pnn" "$db" + + flags=$(awk -v db="$db" '$2 == "name:" db {print $4}' "$outfile") + if [ "$flags" = "$flag" ]; then + echo "GOOD: db ${db} attached on node ${pnn} with flag $flag" + else + echo "BAD: db ${db} attached on node ${pnn} with wrong flag" + cat "$outfile" + exit 1 + fi +} + +###################################################################### + +testdb1="test_volatile.tdb" +testdb2="test_persistent.tdb" +testdb3="test_replicated.tdb" + +test_node="0" + +echo "Shutting down node $test_node" +stop_ctdb_1 "$test_node" +sleep 1 +wait_until_node_has_status 1 recovered +try_command_on_node -v 1 $CTDB status + +echo "Create test databases" +try_command_on_node 1 $CTDB attach "$testdb1" +try_command_on_node 1 $CTDB attach "$testdb2" persistent +try_command_on_node 1 $CTDB attach "$testdb3" replicated + +echo +echo "Checking if database is attached with correct flags" +for node in $(seq 0 $lastnode) ; do + if [ $node -ne $test_node ] ; then + check_db $node $testdb1 "" + check_db $node $testdb2 PERSISTENT + check_db $node $testdb3 REPLICATED + fi +done + +###################################################################### + +echo +echo "Start node $test_node" +start_ctdb_1 "$test_node" +sleep 1 +wait_until_ready + +echo +echo "Checking if database is attached with correct flags" +check_db $test_node $testdb1 "" +check_db $test_node $testdb2 PERSISTENT +check_db $test_node $testdb3 REPLICATED + +###################################################################### + +echo +echo "Restarting node $test_node" +restart_ctdb_1 "$test_node" +sleep 1 +wait_until_ready + +echo +echo "Checking if database is attached with correct flags" +check_db $test_node $testdb1 "" +check_db $test_node $testdb2 PERSISTENT +check_db $test_node $testdb3 REPLICATED diff --git a/ctdb/tests/INTEGRATION/database/basics.003.detach.sh b/ctdb/tests/INTEGRATION/database/basics.003.detach.sh new file mode 100755 index 00000000000..5d1e12328c6 --- /dev/null +++ b/ctdb/tests/INTEGRATION/database/basics.003.detach.sh @@ -0,0 +1,185 @@ +#!/bin/bash + +test_info() +{ + cat <= 10 msgs/sec" +else + echo "BAD: $mps msgs/sec < 10 msgs/sec" + exit 1 +fi diff --git a/ctdb/tests/INTEGRATION/database/readonly.001.basic.sh b/ctdb/tests/INTEGRATION/database/readonly.001.basic.sh new file mode 100755 index 00000000000..a83b4d31530 --- /dev/null +++ b/ctdb/tests/INTEGRATION/database/readonly.001.basic.sh @@ -0,0 +1,196 @@ +#!/bin/bash + +test_info() +{ + cat </dev/null & + RECLOOP_PID=$! + ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1" +} + +. "${TEST_SCRIPTS_DIR}/integration.bash" + +ctdb_test_init + +set -e + +cluster_is_healthy + +TESTDB="persistent_trans.tdb" + +try_command_on_node 0 "$CTDB attach $TESTDB persistent" +try_command_on_node 0 "$CTDB wipedb $TESTDB" + +try_command_on_node 0 "$CTDB listnodes | wc -l" +num_nodes="$out" + +if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then + CTDB_TEST_TIMELIMIT=30 +fi + +t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ + -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT} \ + -D ${TESTDB} -T persistent -k testkey" + +echo "Starting recovery loop" +recovery_loop_start + +echo "Running transaction_loop on all $num_nodes nodes." +try_command_on_node -v -p all "$t" diff --git a/ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh b/ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh new file mode 100755 index 00000000000..90b5ee06151 --- /dev/null +++ b/ctdb/tests/INTEGRATION/database/transaction.004.update_record.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +test_info() +{ + cat </dev/null & + RECLOOP_PID=$! + ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1" +} + +. "${TEST_SCRIPTS_DIR}/integration.bash" + +ctdb_test_init + +set -e + +cluster_is_healthy + +TESTDB="replicated_trans.tdb" + +try_command_on_node 0 "$CTDB attach $TESTDB replicated" +try_command_on_node 0 "$CTDB wipedb $TESTDB" + +try_command_on_node 0 "$CTDB listnodes | wc -l" +num_nodes="$out" + +if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then + CTDB_TEST_TIMELIMIT=30 +fi + +t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ + -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT} \ + -D ${TESTDB} -T replicated -k testkey" + +echo "Starting recovery loop" +recovery_loop_start + +echo "Running transaction_loop on all $num_nodes nodes." +try_command_on_node -v -p all "$t" diff --git a/ctdb/tests/INTEGRATION/database/traverse.001.one.sh b/ctdb/tests/INTEGRATION/database/traverse.001.one.sh new file mode 100755 index 00000000000..7f3007d5105 --- /dev/null +++ b/ctdb/tests/INTEGRATION/database/traverse.001.one.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +test_info() +{ + cat </dev/null 2>&1 || true" +} +ctdb_test_exit_hook_add restore_public_addresses + +# ctdb reloadips will fail if it can't disable takover runs. The most +# likely reason for this is that there is already a takeover run in +# progress. We can't predict when this will happen, so retry if this +# occurs. +do_ctdb_reloadips () +{ + local retry_max=10 + local retry_count=0 + while : ; do + if try_command_on_node any "$CTDB reloadips all" ; then + return 0 + fi + + if [ "$out" != "Failed to disable takeover runs" ] ; then + return 1 + fi + + if [ $retry_count -ge $retry_max ] ; then + return 1 + fi + + retry_count=$((retry_count + 1)) + echo "Retrying..." + sleep_for 1 + done +} + + +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 + +try_command_on_node $test_node $CTDB ip + +if grep "^${test_ip} " <<<"$out" ; then + cat < 1 { print $2 }' "$outfile") +echo "Node ${test_node} has interfaces: ${ifaces}" + +# Delete all IPs on each interface... deleting IPs from one interface +# can cause other interfaces to disappear, so we need to be careful... +for i in $ifaces ; do + try_command_on_node $test_node "$CTDB ifaces -X" + info=$(awk -F'|' -v iface="$i" '$2 == iface { print $0 }' "$outfile") + + if [ -z "$info" ] ; then + echo "Interface ${i} missing... assuming already deleted!" + continue + fi + + echo "Deleting IPs on interface ${i}, with this information:" + echo " $info" + + try_command_on_node $test_node "$CTDB ip -v -X | tail -n +2" + awk -F'|' -v i="$i" \ + '$6 == i { print $2 }' "$outfile" | + while read ip ; do + echo " $ip" + try_command_on_node $test_node "$CTDB delip $ip" + done + try_command_on_node $test_node "$CTDB ipreallocate" + + try_command_on_node $test_node "$CTDB ifaces -X" + info=$(awk -F'|' -v iface="$i" '$2 == iface { print $0 }' "$outfile") + + if [ -z "$info" ] ; then + echo "GOOD: Interface ${i} has been garbage collected" + else + echo "BAD: Interface ${i} still exists" + echo "$out" + exit 1 + fi +done diff --git a/ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh b/ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh new file mode 100755 index 00000000000..699ccc3d2ee --- /dev/null +++ b/ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +test_info() +{ + cat <' command from another node to this + node. +5. Verify that the command is not successful since th ctdb daemon is + not running on the node. + +Expected results: + +* The 'ctdb ping' command shows valid and expected output. +EOF +} + +. "${TEST_SCRIPTS_DIR}/integration.bash" + +ctdb_test_init + +set -e + +cluster_is_healthy + +try_command_on_node -v 0 "$CTDB ping -n 1" + +sanity_check_output \ + 1 \ + '^response from 1 time=-?[.0-9]+ sec[[:space:]]+\([[:digit:]]+ clients\)$' + +try_command_on_node -v 0 "$CTDB shutdown -n 1" + +wait_until_node_has_status 1 disconnected 30 0 + +try_command_on_node -v 0 "! $CTDB ping -n 1" + +sanity_check_output \ + 1 \ + "(: ctdb_control error: ('ctdb_control to disconnected node'|'node is disconnected')|Unable to get ping response from node 1|Node 1 is DISCONNECTED|ctdb_control for getpnn failed|: Can not access node. Node is not operational\.|Node 1 has status DISCONNECTED\|UNHEALTHY\|INACTIVE$)" diff --git a/ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh b/ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh new file mode 100755 index 00000000000..48540d052b2 --- /dev/null +++ b/ctdb/tests/INTEGRATION/simple/basics.004.getpid.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +test_info() +{ + cat <' on the nodes to check the PID of the + ctdbd process. +3. Verify that the output is valid. + +Expected results: + +* 'ctdb getpid' shows valid output. +EOF +} + +. "${TEST_SCRIPTS_DIR}/integration.bash" + +ctdb_test_init + +set -e + +cluster_is_healthy + +try_command_on_node 0 "$CTDB listnodes | wc -l" +num_nodes="$out" +echo "There are $num_nodes nodes..." + +# Call getpid a few different ways and make sure the answer is always the same. + +try_command_on_node -v 0 "onnode -q all $CTDB getpid" +pids_onnode="$out" + +cmd="" +n=0 +while [ $n -lt $num_nodes ] ; do + cmd="${cmd}${cmd:+; }$CTDB getpid -n $n" + n=$(($n + 1)) +done +try_command_on_node -v 0 "( $cmd )" +pids_getpid_n="$out" + +if [ "$pids_onnode" = "$pids_getpid_n" ] ; then + echo "They're the same... cool!" +else + die "Error: they differ." +fi + +echo "Checking each PID for validity" + +n=0 +while [ $n -lt $num_nodes ] ; do + read pid + try_command_on_node $n "ls -l /proc/${pid}/exe | sed -e 's@.*/@@'" + echo -n "Node ${n}, PID ${pid} looks to be running \"$out\" - " + case "$out" in + ctdbd) : ;; + memcheck*) + if [ -z "$VALGRIND" ] ; then + die "BAD" + fi + ;; + *) die "BAD" + esac + + echo "GOOD!" + + n=$(($n + 1)) +done <<<"$pids_onnode" diff --git a/ctdb/tests/INTEGRATION/simple/basics.005.process_exists.sh b/ctdb/tests/INTEGRATION/simple/basics.005.process_exists.sh new file mode 100755 index 00000000000..ae331bcec33 --- /dev/null +++ b/ctdb/tests/INTEGRATION/simple/basics.005.process_exists.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +test_info() +{ + cat <' on the node and verify that the + correct output is shown. +4. Run 'ctdb process-exists ' with a pid of ctdb daemon + process and verify that the correct output is shown. + +Expected results: + +* 'ctdb process-exists' shows the correct output. +EOF +} + +. "${TEST_SCRIPTS_DIR}/integration.bash" + +ctdb_test_init + +set -e + +cluster_is_healthy + +test_node=1 +srvid=0xAE00000012345678 + +# Execute a ctdb client on $test_node that will last for 60 seconds. +# It should still be there when we check. +try_command_on_node -v $test_node \ + "$CTDB_TEST_WRAPPER exec dummy_client -n 10 -S ${srvid} >/dev/null 2>&1 & echo \$!" +client_pid="$out" + +cleanup () +{ + if [ -n "$client_pid" ] ; then + onnode $test_node kill -9 "$client_pid" + fi +} + +ctdb_test_exit_hook_add cleanup + +echo "Waiting until PID $client_pid is registered on node $test_node" +status=0 +wait_until 30 try_command_on_node $test_node \ + "$CTDB process-exists ${client_pid}" || status=$? +echo "$out" + +if [ $status -eq 0 ] ; then + echo "OK" +else + die "BAD" +fi + +echo "Checking for PID $client_pid with SRVID $srvid on node $test_node" +status=0 +try_command_on_node $test_node \ + "$CTDB process-exists ${client_pid} ${srvid}" || status=$? +echo "$out" + +if [ $status -eq 0 ] ; then + echo "OK" +else + die "BAD" +fi + +echo "Checking for PID $client_pid with SRVID $client_pid on node $test_node" +try_command_on_node -v $test_node \ + "! $CTDB process-exists ${client_pid} ${client_pid}" + +# Now just echo the PID of the ctdb daemon on test node. +# This is not a ctdb client and process-exists should return error. +try_command_on_node $test_node "ctdb getpid" +pid="$out" + +echo "Checking for PID $pid on node $test_node" +try_command_on_node -v $test_node "! $CTDB process-exists ${pid}" diff --git a/ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh b/ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh new file mode 100755 index 00000000000..cda6e5f478e --- /dev/null +++ b/ctdb/tests/INTEGRATION/simple/basics.010.statistics.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +test_info() +{ + cat <= 10 msgs/sec" +else + echo "BAD: $mps msgs/sec < 10 msgs/sec" + exit 1 +fi + +stuff="${stuff#*msgs/sec (+ve=}" +positive="${stuff%% *}" + +if [ $positive -ge 10 ] ; then + echo "OK: +ive ($positive) >= 10" +else + echo "BAD: +ive ($positive) < 10" + exit 1 +fi + +stuff="${stuff#*-ve=}" +negative="${stuff%)}" + +if [ $negative -ge 10 ] ; then + echo "OK: -ive ($negative) >= 10" +else + echo "BAD: -ive ($negative) < 10" + exit 1 +fi diff --git a/ctdb/tests/INTEGRATION/simple/cluster.021.tunnel_ring.sh b/ctdb/tests/INTEGRATION/simple/cluster.021.tunnel_ring.sh new file mode 100755 index 00000000000..c78c4209ea6 --- /dev/null +++ b/ctdb/tests/INTEGRATION/simple/cluster.021.tunnel_ring.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +test_info() +{ + cat <= 10 msgs/sec" +else + echo "BAD: $mps msgs/sec < 10 msgs/sec" + exit 1 +fi diff --git a/ctdb/tests/INTEGRATION/simple/cluster.090.unreachable.sh b/ctdb/tests/INTEGRATION/simple/cluster.090.unreachable.sh new file mode 100755 index 00000000000..d7c0c0f9100 --- /dev/null +++ b/ctdb/tests/INTEGRATION/simple/cluster.090.unreachable.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +test_info() +{ + cat <'. +3. Verify that the status of the node changes to 'DISCONNECTED'. +4. Now run 'ctdb ip -n ' from another node. +5. Verify that an error message is printed stating that the node is + disconnected. +6. Execute some other commands against the shutdown node. For example, + disable, enable, ban, unban, listvars. +7. For each command, verify that an error message is printed stating + that the node is disconnected. + +Expected results: + +* For a node on which ctdb is not running, all commands display an + error message stating that the node is disconnected. +EOF +} + +. "${TEST_SCRIPTS_DIR}/integration.bash" + +ctdb_test_init + +set -e + +cluster_is_healthy + +test_node=1 + +try_command_on_node 0 "$CTDB listnodes | wc -l" +num_nodes="$out" +echo "There are $num_nodes nodes." + +echo "Shutting down node ${test_node}..." +try_command_on_node $test_node $CTDB shutdown + +wait_until_node_has_status $test_node disconnected 30 0 + +wait_until_node_has_status 0 recovered 30 0 + +pat="ctdb_control error: 'ctdb_control to disconnected node'|ctdb_control error: 'node is disconnected'|Node $test_node is DISCONNECTED|Node $test_node has status DISCONNECTED\|UNHEALTHY\|INACTIVE" + +for i in ip disable enable "ban 0" unban listvars ; do + try_command_on_node -v 0 ! $CTDB $i -n $test_node + + if egrep -q "$pat" "$outfile" ; then + echo "OK: \"ctdb ${i}\" fails with expected \"disconnected node\" message" + else + echo "BAD: \"ctdb ${i}\" does not fail with expected \"disconnected node\" message" + exit 1 + fi +done diff --git a/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh new file mode 100755 index 00000000000..5329b49b23a --- /dev/null +++ b/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +test_info() +{ + cat <'. + +Expected results: + +* 'ctdb getdebug' shows the debug level on all the nodes. +EOF +} + +. "${TEST_SCRIPTS_DIR}/integration.bash" + +ctdb_test_init + +set -e + +cluster_is_healthy + +try_command_on_node 0 "$CTDB listnodes | wc -l" +num_nodes="$out" + +try_command_on_node -v 1 "onnode -q all $CTDB getdebug" +getdebug_onnode="$out" + +sanity_check_output \ + $num_nodes \ + '^(ERROR|WARNING|NOTICE|INFO|DEBUG)$' + +cmd="" +n=0 +while [ $n -lt $num_nodes ] ; do + cmd="${cmd}${cmd:+; }$CTDB getdebug -n $n" + n=$(($n + 1)) +done +try_command_on_node -v 1 "$cmd" +getdebug_n="$out" + +if [ "$getdebug_onnode" = "$getdebug_n" ] ; then + echo "They're the same... cool!" +else + die "Error: they differ." +fi + +seps="" +nl=" +" +while read line ; do + t=$(echo "$line" | sed -r -e 's@Node [[:digit:]]+ is at debug level ([[:alpha:]]+) \((-?[[:digit:]]+)\)$@\|\1\|\2|@') + seps="${seps}${seps:+${nl}}|Name|Level|${nl}${t}" +done <<<"$getdebug_onnode" diff --git a/ctdb/tests/INTEGRATION/simple/debug.002.setdebug.sh b/ctdb/tests/INTEGRATION/simple/debug.002.setdebug.sh new file mode 100755 index 00000000000..3e04ca33733 --- /dev/null +++ b/ctdb/tests/INTEGRATION/simple/debug.002.setdebug.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +test_info() +{ + cat </dev/null 2>&1" ; then + stackpat=' +---- Stack trace of interesting process [0-9]*\\[sleep\\] ---- +[<[0-9a-f]*>] .*sleep+.* +' +else + stackpat='' +fi + +while IFS="" read pattern ; do + [ -n "$pattern" ] || continue + if grep -q -- "^${pattern}\$" "$debug_output" ; then + printf 'GOOD: output contains "%s"\n' "$pattern" + else + printf 'BAD: output does not contain "%s"\n' "$pattern" + exit 1 + fi +done <' on the nodes to check the PID of the - ctdbd process. -3. Verify that the output is valid. - -Expected results: - -* 'ctdb getpid' shows valid output. -EOF -} - -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - -try_command_on_node 0 "$CTDB listnodes | wc -l" -num_nodes="$out" -echo "There are $num_nodes nodes..." - -# Call getpid a few different ways and make sure the answer is always the same. - -try_command_on_node -v 0 "onnode -q all $CTDB getpid" -pids_onnode="$out" - -cmd="" -n=0 -while [ $n -lt $num_nodes ] ; do - cmd="${cmd}${cmd:+; }$CTDB getpid -n $n" - n=$(($n + 1)) -done -try_command_on_node -v 0 "( $cmd )" -pids_getpid_n="$out" - -if [ "$pids_onnode" = "$pids_getpid_n" ] ; then - echo "They're the same... cool!" -else - die "Error: they differ." -fi - -echo "Checking each PID for validity" - -n=0 -while [ $n -lt $num_nodes ] ; do - read pid - try_command_on_node $n "ls -l /proc/${pid}/exe | sed -e 's@.*/@@'" - echo -n "Node ${n}, PID ${pid} looks to be running \"$out\" - " - case "$out" in - ctdbd) : ;; - memcheck*) - if [ -z "$VALGRIND" ] ; then - die "BAD" - fi - ;; - *) die "BAD" - esac - - echo "GOOD!" - - n=$(($n + 1)) -done <<<"$pids_onnode" diff --git a/ctdb/tests/simple/07_ctdb_process_exists.sh b/ctdb/tests/simple/07_ctdb_process_exists.sh deleted file mode 100755 index ae331bcec33..00000000000 --- a/ctdb/tests/simple/07_ctdb_process_exists.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat <' on the node and verify that the - correct output is shown. -4. Run 'ctdb process-exists ' with a pid of ctdb daemon - process and verify that the correct output is shown. - -Expected results: - -* 'ctdb process-exists' shows the correct output. -EOF -} - -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - -test_node=1 -srvid=0xAE00000012345678 - -# Execute a ctdb client on $test_node that will last for 60 seconds. -# It should still be there when we check. -try_command_on_node -v $test_node \ - "$CTDB_TEST_WRAPPER exec dummy_client -n 10 -S ${srvid} >/dev/null 2>&1 & echo \$!" -client_pid="$out" - -cleanup () -{ - if [ -n "$client_pid" ] ; then - onnode $test_node kill -9 "$client_pid" - fi -} - -ctdb_test_exit_hook_add cleanup - -echo "Waiting until PID $client_pid is registered on node $test_node" -status=0 -wait_until 30 try_command_on_node $test_node \ - "$CTDB process-exists ${client_pid}" || status=$? -echo "$out" - -if [ $status -eq 0 ] ; then - echo "OK" -else - die "BAD" -fi - -echo "Checking for PID $client_pid with SRVID $srvid on node $test_node" -status=0 -try_command_on_node $test_node \ - "$CTDB process-exists ${client_pid} ${srvid}" || status=$? -echo "$out" - -if [ $status -eq 0 ] ; then - echo "OK" -else - die "BAD" -fi - -echo "Checking for PID $client_pid with SRVID $client_pid on node $test_node" -try_command_on_node -v $test_node \ - "! $CTDB process-exists ${client_pid} ${client_pid}" - -# Now just echo the PID of the ctdb daemon on test node. -# This is not a ctdb client and process-exists should return error. -try_command_on_node $test_node "ctdb getpid" -pid="$out" - -echo "Checking for PID $pid on node $test_node" -try_command_on_node -v $test_node "! $CTDB process-exists ${pid}" diff --git a/ctdb/tests/simple/08_ctdb_isnotrecmaster.sh b/ctdb/tests/simple/08_ctdb_isnotrecmaster.sh deleted file mode 100755 index 68e22879ba3..00000000000 --- a/ctdb/tests/simple/08_ctdb_isnotrecmaster.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat <' command from another node to this - node. -5. Verify that the command is not successful since th ctdb daemon is - not running on the node. - -Expected results: - -* The 'ctdb ping' command shows valid and expected output. -EOF -} - -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - -try_command_on_node -v 0 "$CTDB ping -n 1" - -sanity_check_output \ - 1 \ - '^response from 1 time=-?[.0-9]+ sec[[:space:]]+\([[:digit:]]+ clients\)$' - -try_command_on_node -v 0 "$CTDB shutdown -n 1" - -wait_until_node_has_status 1 disconnected 30 0 - -try_command_on_node -v 0 "! $CTDB ping -n 1" - -sanity_check_output \ - 1 \ - "(: ctdb_control error: ('ctdb_control to disconnected node'|'node is disconnected')|Unable to get ping response from node 1|Node 1 is DISCONNECTED|ctdb_control for getpnn failed|: Can not access node. Node is not operational\.|Node 1 has status DISCONNECTED\|UNHEALTHY\|INACTIVE$)" diff --git a/ctdb/tests/simple/11_ctdb_ip.sh b/ctdb/tests/simple/11_ctdb_ip.sh deleted file mode 100755 index d9fdd28f775..00000000000 --- a/ctdb/tests/simple/11_ctdb_ip.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat <'. - -Expected results: - -* 'ctdb getdebug' shows the debug level on all the nodes. -EOF -} - -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - -try_command_on_node 0 "$CTDB listnodes | wc -l" -num_nodes="$out" - -try_command_on_node -v 1 "onnode -q all $CTDB getdebug" -getdebug_onnode="$out" - -sanity_check_output \ - $num_nodes \ - '^(ERROR|WARNING|NOTICE|INFO|DEBUG)$' - -cmd="" -n=0 -while [ $n -lt $num_nodes ] ; do - cmd="${cmd}${cmd:+; }$CTDB getdebug -n $n" - n=$(($n + 1)) -done -try_command_on_node -v 1 "$cmd" -getdebug_n="$out" - -if [ "$getdebug_onnode" = "$getdebug_n" ] ; then - echo "They're the same... cool!" -else - die "Error: they differ." -fi - -seps="" -nl=" -" -while read line ; do - t=$(echo "$line" | sed -r -e 's@Node [[:digit:]]+ is at debug level ([[:alpha:]]+) \((-?[[:digit:]]+)\)$@\|\1\|\2|@') - seps="${seps}${seps:+${nl}}|Name|Level|${nl}${t}" -done <<<"$getdebug_onnode" diff --git a/ctdb/tests/simple/13_ctdb_setdebug.sh b/ctdb/tests/simple/13_ctdb_setdebug.sh deleted file mode 100755 index 3e04ca33733..00000000000 --- a/ctdb/tests/simple/13_ctdb_setdebug.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat </dev/null 2>&1 || true" -} -ctdb_test_exit_hook_add restore_public_addresses - -# ctdb reloadips will fail if it can't disable takover runs. The most -# likely reason for this is that there is already a takeover run in -# progress. We can't predict when this will happen, so retry if this -# occurs. -do_ctdb_reloadips () -{ - local retry_max=10 - local retry_count=0 - while : ; do - if try_command_on_node any "$CTDB reloadips all" ; then - return 0 - fi - - if [ "$out" != "Failed to disable takeover runs" ] ; then - return 1 - fi - - if [ $retry_count -ge $retry_max ] ; then - return 1 - fi - - retry_count=$((retry_count + 1)) - echo "Retrying..." - sleep_for 1 - done -} - - -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 - -try_command_on_node $test_node $CTDB ip - -if grep "^${test_ip} " <<<"$out" ; then - cat < 1 { print $2 }' "$outfile") -echo "Node ${test_node} has interfaces: ${ifaces}" - -# Delete all IPs on each interface... deleting IPs from one interface -# can cause other interfaces to disappear, so we need to be careful... -for i in $ifaces ; do - try_command_on_node $test_node "$CTDB ifaces -X" - info=$(awk -F'|' -v iface="$i" '$2 == iface { print $0 }' "$outfile") - - if [ -z "$info" ] ; then - echo "Interface ${i} missing... assuming already deleted!" - continue - fi - - echo "Deleting IPs on interface ${i}, with this information:" - echo " $info" - - try_command_on_node $test_node "$CTDB ip -v -X | tail -n +2" - awk -F'|' -v i="$i" \ - '$6 == i { print $2 }' "$outfile" | - while read ip ; do - echo " $ip" - try_command_on_node $test_node "$CTDB delip $ip" - done - try_command_on_node $test_node "$CTDB ipreallocate" - - try_command_on_node $test_node "$CTDB ifaces -X" - info=$(awk -F'|' -v iface="$i" '$2 == iface { print $0 }' "$outfile") - - if [ -z "$info" ] ; then - echo "GOOD: Interface ${i} has been garbage collected" - else - echo "BAD: Interface ${i} still exists" - echo "$out" - exit 1 - fi -done diff --git a/ctdb/tests/simple/21_ctdb_attach.sh b/ctdb/tests/simple/21_ctdb_attach.sh deleted file mode 100755 index b9ae9481d91..00000000000 --- a/ctdb/tests/simple/21_ctdb_attach.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat </dev/null ; then - return 0 - else - return 1 - fi -} - -check_db () -{ - local pnn="$1" - local db="$2" - local flag="$3" - - local flags - - echo "Waiting until database ${db} is attached on node ${pnn}" - wait_until 10 check_db_once "$pnn" "$db" - - flags=$(awk -v db="$db" '$2 == "name:" db {print $4}' "$outfile") - if [ "$flags" = "$flag" ]; then - echo "GOOD: db ${db} attached on node ${pnn} with flag $flag" - else - echo "BAD: db ${db} attached on node ${pnn} with wrong flag" - cat "$outfile" - exit 1 - fi -} - -###################################################################### - -testdb1="test_volatile.tdb" -testdb2="test_persistent.tdb" -testdb3="test_replicated.tdb" - -test_node="0" - -echo "Shutting down node $test_node" -stop_ctdb_1 "$test_node" -sleep 1 -wait_until_node_has_status 1 recovered -try_command_on_node -v 1 $CTDB status - -echo "Create test databases" -try_command_on_node 1 $CTDB attach "$testdb1" -try_command_on_node 1 $CTDB attach "$testdb2" persistent -try_command_on_node 1 $CTDB attach "$testdb3" replicated - -echo -echo "Checking if database is attached with correct flags" -for node in $(seq 0 $lastnode) ; do - if [ $node -ne $test_node ] ; then - check_db $node $testdb1 "" - check_db $node $testdb2 PERSISTENT - check_db $node $testdb3 REPLICATED - fi -done - -###################################################################### - -echo -echo "Start node $test_node" -start_ctdb_1 "$test_node" -sleep 1 -wait_until_ready - -echo -echo "Checking if database is attached with correct flags" -check_db $test_node $testdb1 "" -check_db $test_node $testdb2 PERSISTENT -check_db $test_node $testdb3 REPLICATED - -###################################################################### - -echo -echo "Restarting node $test_node" -restart_ctdb_1 "$test_node" -sleep 1 -wait_until_ready - -echo -echo "Checking if database is attached with correct flags" -check_db $test_node $testdb1 "" -check_db $test_node $testdb2 PERSISTENT -check_db $test_node $testdb3 REPLICATED diff --git a/ctdb/tests/simple/23_ctdb_moveip.sh b/ctdb/tests/simple/23_ctdb_moveip.sh deleted file mode 100755 index 699ccc3d2ee..00000000000 --- a/ctdb/tests/simple/23_ctdb_moveip.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat </dev/null | - md5sum | - awk '{printf "%s.tdb\n", $1}' -} - -try_command_on_node -v 0 "$CTDB getdbmap" - -db_map_pattern='^(Number of databases:[[:digit:]]+|dbid:0x[[:xdigit:]]+ name:[^[:space:]]+ path:[^[:space:]]+)$' - -sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern" - -num_db_init=$(sed -n -e '1s/.*://p' "$outfile") - -for i in $(seq 1 5) ; do - f=$(make_temp_db_filename) - echo "Creating test database: $f" - try_command_on_node 0 $CTDB attach "$f" - try_command_on_node 0 $CTDB getdbmap - sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern" - num=$(sed -n -e '1s/^.*://p' "$outfile") - if [ $num = $(($num_db_init + $i)) ] ; then - echo "OK: correct number of additional databases" - else - echo "BAD: no additional database" - exit 1 - fi - if awk '{print $2}' "$outfile" | grep -Fqx "name:$f" ; then - echo "OK: getdbmap knows about \"$f\"" - else - echo "BAD: getdbmap does not know about \"$f\"" - exit 1 - fi -done diff --git a/ctdb/tests/simple/25_dumpmemory.sh b/ctdb/tests/simple/25_dumpmemory.sh deleted file mode 100755 index 3d976c17d0f..00000000000 --- a/ctdb/tests/simple/25_dumpmemory.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat <'. -3. Verify that the status of the node changes to 'DISCONNECTED'. -4. Now run 'ctdb ip -n ' from another node. -5. Verify that an error message is printed stating that the node is - disconnected. -6. Execute some other commands against the shutdown node. For example, - disable, enable, ban, unban, listvars. -7. For each command, verify that an error message is printed stating - that the node is disconnected. - -Expected results: - -* For a node on which ctdb is not running, all commands display an - error message stating that the node is disconnected. -EOF -} - -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - -test_node=1 - -try_command_on_node 0 "$CTDB listnodes | wc -l" -num_nodes="$out" -echo "There are $num_nodes nodes." - -echo "Shutting down node ${test_node}..." -try_command_on_node $test_node $CTDB shutdown - -wait_until_node_has_status $test_node disconnected 30 0 - -wait_until_node_has_status 0 recovered 30 0 - -pat="ctdb_control error: 'ctdb_control to disconnected node'|ctdb_control error: 'node is disconnected'|Node $test_node is DISCONNECTED|Node $test_node has status DISCONNECTED\|UNHEALTHY\|INACTIVE" - -for i in ip disable enable "ban 0" unban listvars ; do - try_command_on_node -v 0 ! $CTDB $i -n $test_node - - if egrep -q "$pat" "$outfile" ; then - echo "OK: \"ctdb ${i}\" fails with expected \"disconnected node\" message" - else - echo "BAD: \"ctdb ${i}\" does not fail with expected \"disconnected node\" message" - exit 1 - fi -done diff --git a/ctdb/tests/simple/27_ctdb_detach.sh b/ctdb/tests/simple/27_ctdb_detach.sh deleted file mode 100755 index 5d1e12328c6..00000000000 --- a/ctdb/tests/simple/27_ctdb_detach.sh +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat <= 10 msgs/sec" -else - echo "BAD: $mps msgs/sec < 10 msgs/sec" - exit 1 -fi - -stuff="${stuff#*msgs/sec (+ve=}" -positive="${stuff%% *}" - -if [ $positive -ge 10 ] ; then - echo "OK: +ive ($positive) >= 10" -else - echo "BAD: +ive ($positive) < 10" - exit 1 -fi - -stuff="${stuff#*-ve=}" -negative="${stuff%)}" - -if [ $negative -ge 10 ] ; then - echo "OK: -ive ($negative) >= 10" -else - echo "BAD: -ive ($negative) < 10" - exit 1 -fi diff --git a/ctdb/tests/simple/52_fetch_ring.sh b/ctdb/tests/simple/52_fetch_ring.sh deleted file mode 100755 index 05632024cb5..00000000000 --- a/ctdb/tests/simple/52_fetch_ring.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat <= 10 msgs/sec" -else - echo "BAD: $mps msgs/sec < 10 msgs/sec" - exit 1 -fi diff --git a/ctdb/tests/simple/53_transaction_loop.sh b/ctdb/tests/simple/53_transaction_loop.sh deleted file mode 100755 index d47761216ce..00000000000 --- a/ctdb/tests/simple/53_transaction_loop.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat </dev/null & - RECLOOP_PID=$! - ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1" -} - -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - -TESTDB="persistent_trans.tdb" - -try_command_on_node 0 "$CTDB attach $TESTDB persistent" -try_command_on_node 0 "$CTDB wipedb $TESTDB" - -try_command_on_node 0 "$CTDB listnodes | wc -l" -num_nodes="$out" - -if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then - CTDB_TEST_TIMELIMIT=30 -fi - -t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ - -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT} \ - -D ${TESTDB} -T persistent -k testkey" - -echo "Starting recovery loop" -recovery_loop_start - -echo "Running transaction_loop on all $num_nodes nodes." -try_command_on_node -v -p all "$t" diff --git a/ctdb/tests/simple/55_ctdb_ptrans.sh b/ctdb/tests/simple/55_ctdb_ptrans.sh deleted file mode 100755 index 72b18348398..00000000000 --- a/ctdb/tests/simple/55_ctdb_ptrans.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat </dev/null & - RECLOOP_PID=$! - ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1" -} - -. "${TEST_SCRIPTS_DIR}/integration.bash" - -ctdb_test_init - -set -e - -cluster_is_healthy - -TESTDB="replicated_trans.tdb" - -try_command_on_node 0 "$CTDB attach $TESTDB replicated" -try_command_on_node 0 "$CTDB wipedb $TESTDB" - -try_command_on_node 0 "$CTDB listnodes | wc -l" -num_nodes="$out" - -if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then - CTDB_TEST_TIMELIMIT=30 -fi - -t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \ - -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT} \ - -D ${TESTDB} -T replicated -k testkey" - -echo "Starting recovery loop" -recovery_loop_start - -echo "Running transaction_loop on all $num_nodes nodes." -try_command_on_node -v -p all "$t" diff --git a/ctdb/tests/simple/58_ctdb_restoredb.sh b/ctdb/tests/simple/58_ctdb_restoredb.sh deleted file mode 100755 index 579233e0e80..00000000000 --- a/ctdb/tests/simple/58_ctdb_restoredb.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat <= 10 msgs/sec" -else - echo "BAD: $mps msgs/sec < 10 msgs/sec" - exit 1 -fi diff --git a/ctdb/tests/simple/90_debug_hung_script.sh b/ctdb/tests/simple/90_debug_hung_script.sh deleted file mode 100755 index af045cf785e..00000000000 --- a/ctdb/tests/simple/90_debug_hung_script.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -test_info() -{ - cat </dev/null 2>&1" ; then - stackpat=' ----- Stack trace of interesting process [0-9]*\\[sleep\\] ---- -[<[0-9a-f]*>] .*sleep+.* -' -else - stackpat='' -fi - -while IFS="" read pattern ; do - [ -n "$pattern" ] || continue - if grep -q -- "^${pattern}\$" "$debug_output" ; then - printf 'GOOD: output contains "%s"\n' "$pattern" - else - printf 'BAD: output does not contain "%s"\n' "$pattern" - exit 1 - fi -done <