diff options
author | Martin Schwenke <martin@meltin.net> | 2019-12-10 14:50:42 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2020-07-22 02:42:37 +0000 |
commit | 65f56505e29c01d5891e5bc1050b6c37b8cbdee7 (patch) | |
tree | 6b4380b883915d41e11441a923a6c39f02e4ed57 /ctdb/tests/INTEGRATION/failover | |
parent | a55dd6f17b6d65db77bcd4f5a011e9aef64729e5 (diff) | |
download | samba-65f56505e29c01d5891e5bc1050b6c37b8cbdee7.tar.gz |
ctdb-tests: Update preamble for INTEGRATION tests
* Use "#!/usr/bin/env bash" for improved portability
* Drop test_info() definition and replace it with a comment
The use of test_info() is pointless.
* Drop call to cluster_is_healthy()
This is a holdover from when the previous test would restart daemons
to get things ready for a test. There was also a bug where going
into recovery during the restart would sometimes cause the cluster
to become unhealthy. If we really need something like this then we
can add it to ctdb_test_init().
* Make order of preamble consistent
Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/tests/INTEGRATION/failover')
11 files changed, 45 insertions, 169 deletions
diff --git a/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh b/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh index d8e0097362f..2fc75b731b9 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh @@ -1,35 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that 'ctdb ip' shows the correct output. - -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 ip' on one of the nodes and verify the list of IP - addresses displayed (cross check the result with the output of - 'ip addr show' on the node). -3. Verify that pipe-separated output is generated with the -X option. - -Expected results: - -* 'ctdb ip' shows the list of public IPs being served by a node. -EOF -} +# Verify that 'ctdb ip' shows the correct output . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init echo "Getting list of public IPs..." try_command_on_node -v 1 "$CTDB ip all | tail -n +2" diff --git a/ctdb/tests/INTEGRATION/failover/pubips.010.addip.sh b/ctdb/tests/INTEGRATION/failover/pubips.010.addip.sh index aefed54c45e..aba85dd0499 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.010.addip.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.010.addip.sh @@ -1,22 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that an IP address can be added to a node using 'ctdb addip'. - -This test does not do any network level checks to make sure IP -addresses are actually on interfaces. It just consults "ctdb ip". -EOF -} +# Verify that an IP address can be added to a node using 'ctdb addip' . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init select_test_node_and_ips get_test_ip_mask_and_iface diff --git a/ctdb/tests/INTEGRATION/failover/pubips.011.delip.sh b/ctdb/tests/INTEGRATION/failover/pubips.011.delip.sh index d3f0f3a012b..5235a9d3203 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.011.delip.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.011.delip.sh @@ -1,22 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that a node's public IP address can be deleted using 'ctdb deleteip'. - -This test does not do any network level checks to make sure IP -addresses are actually on interfaces. It just consults "ctdb ip". -EOF -} +# Verify that a node's public IP address can be deleted using 'ctdb deleteip' . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init select_test_node_and_ips diff --git a/ctdb/tests/INTEGRATION/failover/pubips.012.reloadips.sh b/ctdb/tests/INTEGRATION/failover/pubips.012.reloadips.sh index 451fca3a866..829b83930da 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.012.reloadips.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.012.reloadips.sh @@ -1,31 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that IPs can be rearrranged using 'ctdb reloadips'. - -Various sub-tests that remove addresses from the public_addresses file -on a node or delete the entire contents of the public_addresses file. +# Verify that IPs can be reconfigured using 'ctdb reloadips' -Prerequisites: - -* An active CTDB cluster with at least 2 active nodes. - -Expected results: - -* When addresses are deconfigured "ctdb ip" no longer reports them and - when added they are seen again. -EOF -} +# Various sub-tests that remove addresses from the public_addresses file +# on a node or delete the entire contents of the public_addresses file. . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init select_test_node_and_ips diff --git a/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh b/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh index 0c6fd833a5e..1c13a3ce3c2 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.013.failover_noop.sh @@ -1,17 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Check that CTDB operates correctly if: +# Check that CTDB operates correctly if: -* failover is disabled; or -* there are 0 public IPs configured - -This test only does anything with local daemons. On a real cluster it -has no way of updating configuration. -EOF -} +# * failover is disabled; or +# * there are 0 public IPs configured . "${TEST_SCRIPTS_DIR}/integration.bash" diff --git a/ctdb/tests/INTEGRATION/failover/pubips.014.iface_gc.sh b/ctdb/tests/INTEGRATION/failover/pubips.014.iface_gc.sh index 2756f64ceb1..845b4b50fdb 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.014.iface_gc.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.014.iface_gc.sh @@ -1,19 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that an interface is deleted when all IPs on it are deleted. -EOF -} +# Verify that an interface is deleted when all IPs on it are deleted . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init select_test_node_and_ips diff --git a/ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh b/ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh index 699ccc3d2ee..68b5e079d66 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.020.moveip.sh @@ -1,25 +1,18 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that 'ctdb moveip' allows movement of public IPs between cluster nodes. +# Verify that 'ctdb moveip' allows movement of public IPs between nodes -This test does not do any network level checks to make sure IP -addresses are actually on interfaces. It just consults "ctdb ip". +# This test does not do any network level checks to make sure IP +# addresses are actually on interfaces. It just consults "ctdb ip". -To work, this test ensures that IPAllocAlgorithm is not set to 0 -(Deterministic IPs) and sets NoIPFailback. -EOF -} +# To work, this test ensures that IPAllocAlgorithm is not set to 0 +# (Deterministic IPs) and sets NoIPFailback. . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init select_test_node_and_ips diff --git a/ctdb/tests/INTEGRATION/failover/pubips.030.disable_enable.sh b/ctdb/tests/INTEGRATION/failover/pubips.030.disable_enable.sh index c0bb62d1991..9a1616ceefc 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.030.disable_enable.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.030.disable_enable.sh @@ -1,22 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify the operation of "ctdb disable" and "ctdb enable" -EOF -} +# Verify the operation of "ctdb disable" and "ctdb enable" . "${TEST_SCRIPTS_DIR}/integration.bash" +set -e + ctdb_test_init ######################################## -set -e - -cluster_is_healthy - select_test_node_and_ips echo "Disabling node $test_node" diff --git a/ctdb/tests/INTEGRATION/failover/pubips.032.stop_continue.sh b/ctdb/tests/INTEGRATION/failover/pubips.032.stop_continue.sh index d9a64508180..f5936b03d88 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.032.stop_continue.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.032.stop_continue.sh @@ -1,19 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify the operation of "ctdb stop" and "ctdb continue" -EOF -} +# Verify the operation of "ctdb stop" and "ctdb continue" . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init select_test_node_and_ips diff --git a/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh b/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh index 9af55d8e7ef..a39e48d0883 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.040.NoIPTakeover.sh @@ -1,34 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that 'ctdb setvar NoIPTakeover 1' stops ip addresses from being failed -over onto the node. - -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. Use 'ctdb ip' on one of the nodes to list the IP addresses being - served. -3. Use 'ctdb moveip' to move an address from one node to another. -4. Verify that the IP is no longer being hosted by the first node and is now being hosted by the second node. - -Expected results: - -* 'ctdb moveip' allows an IP address to be moved between cluster nodes. -EOF -} +# Verify that 'ctdb setvar NoIPTakeover 1' stops IP addresses being taken over . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init +set -e -cluster_is_healthy +ctdb_test_init try_command_on_node 0 "$CTDB listnodes | wc -l" num_nodes="$out" diff --git a/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh b/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh index c455784c886..543f9a96d89 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh @@ -1,24 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash -test_info() -{ - cat <<EOF -Verify that the recovery daemon handles unhosted IPs properly. +# Verify that the recovery daemon handles unhosted IPs properly -This test does not do any network level checks to make sure the IP -address is actually on an interface. It just consults "ctdb ip". +# This test does not do any network level checks to make sure the IP +# address is actually on an interface. It just consults "ctdb ip". -This is a variation of the "addip" test. -EOF -} +# This is a variation of the "addip" test. . "${TEST_SCRIPTS_DIR}/integration.bash" -ctdb_test_init - set -e -cluster_is_healthy +ctdb_test_init select_test_node_and_ips |