diff options
author | Martin Schwenke <martin@meltin.net> | 2012-04-16 15:53:24 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2012-04-16 15:57:16 +1000 |
commit | 76d75f8c81aff0f7716b266b36f0b16ba43f4f50 (patch) | |
tree | 3924833bfbaf6841ec1bedca336cca9b42ea7a5f /ctdb/tests/takeover | |
parent | 8c5fdb40cf950552fd094820b998bda9a580ed03 (diff) | |
download | samba-76d75f8c81aff0f7716b266b36f0b16ba43f4f50.tar.gz samba-76d75f8c81aff0f7716b266b36f0b16ba43f4f50.tar.xz samba-76d75f8c81aff0f7716b266b36f0b16ba43f4f50.zip |
tests/takeover - Restructure according to new convention
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit f94897ef9504c144937409688fa7a646e0b0ceae)
Diffstat (limited to 'ctdb/tests/takeover')
-rwxr-xr-x | ctdb/tests/takeover/lcp2.001.sh (renamed from ctdb/tests/takeover/testcases/lcp2.001.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.002.sh (renamed from ctdb/tests/takeover/testcases/lcp2.002.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.003.sh (renamed from ctdb/tests/takeover/testcases/lcp2.003.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.004.sh (renamed from ctdb/tests/takeover/testcases/lcp2.004.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.005.sh (renamed from ctdb/tests/takeover/testcases/lcp2.005.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.006.sh (renamed from ctdb/tests/takeover/testcases/lcp2.006.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.007.sh (renamed from ctdb/tests/takeover/testcases/lcp2.007.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.008.sh (renamed from ctdb/tests/takeover/testcases/lcp2.008.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.009.sh (renamed from ctdb/tests/takeover/testcases/lcp2.009.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.010.sh (renamed from ctdb/tests/takeover/testcases/lcp2.010.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.011.sh (renamed from ctdb/tests/takeover/testcases/lcp2.011.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.012.sh (renamed from ctdb/tests/takeover/testcases/lcp2.012.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/lcp2.013.sh (renamed from ctdb/tests/takeover/testcases/lcp2.013.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/nondet.001.sh (renamed from ctdb/tests/takeover/testcases/nondet.001.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/nondet.002.sh (renamed from ctdb/tests/takeover/testcases/nondet.002.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/nondet.003.sh (renamed from ctdb/tests/takeover/testcases/nondet.003.sh) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/run_tests.sh | 31 | ||||
-rw-r--r-- | ctdb/tests/takeover/scripts/local.sh (renamed from ctdb/tests/takeover/common.sh) | 16 | ||||
-rw-r--r-- | ctdb/tests/takeover/simulation/README (renamed from ctdb/tests/takeover/README) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/ctdb_takeover.py (renamed from ctdb/tests/takeover/ctdb_takeover.py) | 2 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/hey_jude.py | 24 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/ip_groups1.py (renamed from ctdb/tests/takeover/ip_groups1.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/ip_groups2.py (renamed from ctdb/tests/takeover/ip_groups2.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/ip_groups3.py (renamed from ctdb/tests/takeover/ip_groups3.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/ip_groups4.py (renamed from ctdb/tests/takeover/ip_groups4.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/ip_groups5.py (renamed from ctdb/tests/takeover/ip_groups5.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/mgmt_simple.py (renamed from ctdb/tests/takeover/mgmt_simple.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/node_group.py (renamed from ctdb/tests/takeover/node_group.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/node_group_extra.py (renamed from ctdb/tests/takeover/node_group_extra.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/node_group_simple.py (renamed from ctdb/tests/takeover/node_group_simple.py) | 0 | ||||
-rwxr-xr-x | ctdb/tests/takeover/simulation/nondet_path_01.py (renamed from ctdb/tests/takeover/nondet_path_01.py) | 0 |
31 files changed, 43 insertions, 62 deletions
diff --git a/ctdb/tests/takeover/testcases/lcp2.001.sh b/ctdb/tests/takeover/lcp2.001.sh index f792f5989f..8772318d6e 100755 --- a/ctdb/tests/takeover/testcases/lcp2.001.sh +++ b/ctdb/tests/takeover/lcp2.001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 3 -> 1 healthy" diff --git a/ctdb/tests/takeover/testcases/lcp2.002.sh b/ctdb/tests/takeover/lcp2.002.sh index 17b85ee771..f3f6f0a6b1 100755 --- a/ctdb/tests/takeover/testcases/lcp2.002.sh +++ b/ctdb/tests/takeover/lcp2.002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 3 -> 2 healthy" diff --git a/ctdb/tests/takeover/testcases/lcp2.003.sh b/ctdb/tests/takeover/lcp2.003.sh index f47ad88aad..f6cfe57b2d 100755 --- a/ctdb/tests/takeover/testcases/lcp2.003.sh +++ b/ctdb/tests/takeover/lcp2.003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 1 -> all healthy" diff --git a/ctdb/tests/takeover/testcases/lcp2.004.sh b/ctdb/tests/takeover/lcp2.004.sh index a277bf6eef..c067184d38 100755 --- a/ctdb/tests/takeover/testcases/lcp2.004.sh +++ b/ctdb/tests/takeover/lcp2.004.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 1 -> all healthy, info logging" diff --git a/ctdb/tests/takeover/testcases/lcp2.005.sh b/ctdb/tests/takeover/lcp2.005.sh index 3dbe532cb6..4a8c0ea982 100755 --- a/ctdb/tests/takeover/testcases/lcp2.005.sh +++ b/ctdb/tests/takeover/lcp2.005.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 1 -> all healthy, debug logging" diff --git a/ctdb/tests/takeover/testcases/lcp2.006.sh b/ctdb/tests/takeover/lcp2.006.sh index 639796d6c2..13bb40fd69 100755 --- a/ctdb/tests/takeover/testcases/lcp2.006.sh +++ b/ctdb/tests/takeover/lcp2.006.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 0 -> 1 healthy" diff --git a/ctdb/tests/takeover/testcases/lcp2.007.sh b/ctdb/tests/takeover/lcp2.007.sh index b15fcd8313..76fa06e212 100755 --- a/ctdb/tests/takeover/testcases/lcp2.007.sh +++ b/ctdb/tests/takeover/lcp2.007.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 0 -> 2 healthy" diff --git a/ctdb/tests/takeover/testcases/lcp2.008.sh b/ctdb/tests/takeover/lcp2.008.sh index 48d8532cfd..f5c0af3a7c 100755 --- a/ctdb/tests/takeover/testcases/lcp2.008.sh +++ b/ctdb/tests/takeover/lcp2.008.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 0 -> all healthy" diff --git a/ctdb/tests/takeover/testcases/lcp2.009.sh b/ctdb/tests/takeover/lcp2.009.sh index df706369b8..e862c92807 100755 --- a/ctdb/tests/takeover/testcases/lcp2.009.sh +++ b/ctdb/tests/takeover/lcp2.009.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 3 healthy -> all disconnected" diff --git a/ctdb/tests/takeover/testcases/lcp2.010.sh b/ctdb/tests/takeover/lcp2.010.sh index c47b6528cd..20b1c98e65 100755 --- a/ctdb/tests/takeover/testcases/lcp2.010.sh +++ b/ctdb/tests/takeover/lcp2.010.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "2 disjoint groups of nodes/addresses, a node becomes healthy" diff --git a/ctdb/tests/takeover/testcases/lcp2.011.sh b/ctdb/tests/takeover/lcp2.011.sh index 127a7a3491..f752aa345e 100755 --- a/ctdb/tests/takeover/testcases/lcp2.011.sh +++ b/ctdb/tests/takeover/lcp2.011.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "2 disjoint groups of nodes/addresses, continue a stopped node" diff --git a/ctdb/tests/takeover/testcases/lcp2.012.sh b/ctdb/tests/takeover/lcp2.012.sh index d53b188134..70dad93541 100755 --- a/ctdb/tests/takeover/testcases/lcp2.012.sh +++ b/ctdb/tests/takeover/lcp2.012.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "Node with NODE_FLAGS_NOIPTAKEOVER doesn't gain IPs" diff --git a/ctdb/tests/takeover/testcases/lcp2.013.sh b/ctdb/tests/takeover/lcp2.013.sh index 3e7f45053d..4d01f12507 100755 --- a/ctdb/tests/takeover/testcases/lcp2.013.sh +++ b/ctdb/tests/takeover/lcp2.013.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "Node with NODE_FLAGS_NOIPTAKEOVER doesn't lose IPs" diff --git a/ctdb/tests/takeover/testcases/nondet.001.sh b/ctdb/tests/takeover/nondet.001.sh index 52f4598fb0..71506070c0 100755 --- a/ctdb/tests/takeover/testcases/nondet.001.sh +++ b/ctdb/tests/takeover/nondet.001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 1 healthy" diff --git a/ctdb/tests/takeover/testcases/nondet.002.sh b/ctdb/tests/takeover/nondet.002.sh index 9a4ef44b4d..4ff801b1c4 100755 --- a/ctdb/tests/takeover/testcases/nondet.002.sh +++ b/ctdb/tests/takeover/nondet.002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 2 healthy" diff --git a/ctdb/tests/takeover/testcases/nondet.003.sh b/ctdb/tests/takeover/nondet.003.sh index b75fc6d6f0..2a9dfb4679 100755 --- a/ctdb/tests/takeover/testcases/nondet.003.sh +++ b/ctdb/tests/takeover/nondet.003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${TAKEOVER_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" define_test "3 nodes, 1 -> all healthy" diff --git a/ctdb/tests/takeover/run_tests.sh b/ctdb/tests/takeover/run_tests.sh deleted file mode 100755 index f019e8f9b5..0000000000 --- a/ctdb/tests/takeover/run_tests.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Run some IP allocation unit tests. - -cd $(dirname "$0") -export TAKEOVER_TESTS_DIR=$(pwd) - -test_dir=$(dirname "$TAKEOVER_TESTS_DIR") - -opts="-d" - -for i ; do - case "$i" in - -*) - opts="$opts $i" - shift - ;; - *) - break - esac -done - -tests="" -if [ -z "$*" ] ; then - tests=$(ls testcases/*.[0-9][0-9][0-9].sh 2>/dev/null) -fi - -"$test_dir/scripts/run_tests" $opts "$@" $tests || exit 1 - -echo "All OK" -exit 0 diff --git a/ctdb/tests/takeover/common.sh b/ctdb/tests/takeover/scripts/local.sh index 716e4d5fc7..0e6230ab6f 100644 --- a/ctdb/tests/takeover/common.sh +++ b/ctdb/tests/takeover/scripts/local.sh @@ -1,16 +1,10 @@ # Hey Emacs, this is a -*- shell-script -*- !!! :-) -# Print a message and exit. -die () { echo "$@" >&2 ; exit 1 ; } - -test_prog="$(dirname ${TAKEOVER_TESTS_DIR})/bin/ctdb_takeover_tests ctdb_takeover_run_core" +test_prog="$(dirname ${TEST_SUBDIR})/bin/ctdb_takeover_tests ctdb_takeover_run_core" define_test () { - _f="$0" - _f="${_f#./}" # strip leading ./ - _f="${_f#testcases/}" # strip leading testcases/ - _f="${_f%.sh}" # strip off .sh suffix if any + _f=$(basename "$0" ".sh") case "$_f" in nondet.*) @@ -28,12 +22,6 @@ define_test () printf "%-12s - %s\n" "$_f" "$1" } -required_result () -{ - required_rc="${1:-0}" - required_output=$(cat) -} - simple_test () { _states="$1" diff --git a/ctdb/tests/takeover/README b/ctdb/tests/takeover/simulation/README index 4a8267bf6e..4a8267bf6e 100644 --- a/ctdb/tests/takeover/README +++ b/ctdb/tests/takeover/simulation/README diff --git a/ctdb/tests/takeover/ctdb_takeover.py b/ctdb/tests/takeover/simulation/ctdb_takeover.py index bc24fd4162..4b7ceef468 100755 --- a/ctdb/tests/takeover/ctdb_takeover.py +++ b/ctdb/tests/takeover/simulation/ctdb_takeover.py @@ -786,7 +786,7 @@ class Cluster(object): else: os.environ["CTDB_TEST_LOGLEVEL"] = "0" - p = subprocess.Popen("../bin/ctdb_takeover_tests ctdb_takeover_run_core %s 2>&1" % nodestates, + p = subprocess.Popen("../../bin/ctdb_takeover_tests ctdb_takeover_run_core %s 2>&1" % nodestates, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) p.stdin.write("\n".join(in_lines)) diff --git a/ctdb/tests/takeover/simulation/hey_jude.py b/ctdb/tests/takeover/simulation/hey_jude.py new file mode 100755 index 0000000000..a6b14c5c9b --- /dev/null +++ b/ctdb/tests/takeover/simulation/hey_jude.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +from ctdb_takeover import Cluster, Node, process_args + +process_args() + +addresses10 = ['10.4.20.%d' % n for n in range(154, 168)] +addresses172a = ['172.20.106.%d' % n for n in range(110, 124)] +addresses172b = ['172.20.107.%d' % n for n in range(110, 117)] + +c = Cluster() + +#for i in range(7): +# c.add_node(Node([addresses10, addresses172])) + + +for i in range(4): + c.add_node(Node([addresses172a, addresses172b])) +for i in range(3): + c.add_node(Node(addresses10)) + +c.recover() + +c.random_iterations() diff --git a/ctdb/tests/takeover/ip_groups1.py b/ctdb/tests/takeover/simulation/ip_groups1.py index 0808f466cf..0808f466cf 100755 --- a/ctdb/tests/takeover/ip_groups1.py +++ b/ctdb/tests/takeover/simulation/ip_groups1.py diff --git a/ctdb/tests/takeover/ip_groups2.py b/ctdb/tests/takeover/simulation/ip_groups2.py index c6c1026646..c6c1026646 100755 --- a/ctdb/tests/takeover/ip_groups2.py +++ b/ctdb/tests/takeover/simulation/ip_groups2.py diff --git a/ctdb/tests/takeover/ip_groups3.py b/ctdb/tests/takeover/simulation/ip_groups3.py index 149946d72b..149946d72b 100755 --- a/ctdb/tests/takeover/ip_groups3.py +++ b/ctdb/tests/takeover/simulation/ip_groups3.py diff --git a/ctdb/tests/takeover/ip_groups4.py b/ctdb/tests/takeover/simulation/ip_groups4.py index fdcef7f0a6..fdcef7f0a6 100755 --- a/ctdb/tests/takeover/ip_groups4.py +++ b/ctdb/tests/takeover/simulation/ip_groups4.py diff --git a/ctdb/tests/takeover/ip_groups5.py b/ctdb/tests/takeover/simulation/ip_groups5.py index 8c46150638..8c46150638 100755 --- a/ctdb/tests/takeover/ip_groups5.py +++ b/ctdb/tests/takeover/simulation/ip_groups5.py diff --git a/ctdb/tests/takeover/mgmt_simple.py b/ctdb/tests/takeover/simulation/mgmt_simple.py index f891199655..f891199655 100755 --- a/ctdb/tests/takeover/mgmt_simple.py +++ b/ctdb/tests/takeover/simulation/mgmt_simple.py diff --git a/ctdb/tests/takeover/node_group.py b/ctdb/tests/takeover/simulation/node_group.py index bf7de58aa9..bf7de58aa9 100755 --- a/ctdb/tests/takeover/node_group.py +++ b/ctdb/tests/takeover/simulation/node_group.py diff --git a/ctdb/tests/takeover/node_group_extra.py b/ctdb/tests/takeover/simulation/node_group_extra.py index 7e9e518bdd..7e9e518bdd 100755 --- a/ctdb/tests/takeover/node_group_extra.py +++ b/ctdb/tests/takeover/simulation/node_group_extra.py diff --git a/ctdb/tests/takeover/node_group_simple.py b/ctdb/tests/takeover/simulation/node_group_simple.py index 3c58ef7314..3c58ef7314 100755 --- a/ctdb/tests/takeover/node_group_simple.py +++ b/ctdb/tests/takeover/simulation/node_group_simple.py diff --git a/ctdb/tests/takeover/nondet_path_01.py b/ctdb/tests/takeover/simulation/nondet_path_01.py index a62847a216..a62847a216 100755 --- a/ctdb/tests/takeover/nondet_path_01.py +++ b/ctdb/tests/takeover/simulation/nondet_path_01.py |