The branch, master has been updated via 113c763f15ab1db3810f40504b60bab5d3f2f212 (commit) via 0384f1902bb64d6683b689de226fff4e54331c24 (commit) via cc9a09b2cbe300ad5848932b9273270ad50ea6b0 (commit) via d3dc9410501767c07d9b0106bb73c979d869c127 (commit) via 21cdc7ed6942238faeb42983c862d4abc3f54ffb (commit) via c2efb5897e4258df649149f9904d7ac47322e1b4 (commit) via fed3c2b80b8add8d1cf33abdd5dd8d8001af44d4 (commit) via 93b53b186df55942bf4d9e90cae329f47889af72 (commit) via 18db530880849b59445d7aa508bf218bdd77ea1c (commit) via 651e6703b6dc4d11ba7d6d0b44d3be1f485a0f75 (commit) via bf23e7166385d305c6860b37c120f70a9aa33aa5 (commit) via a6b3a7b7db9aa5fc971aae11b9b012e72c7d240c (commit) via 5d82d89ee99f10bead101aebda645a80435ba246 (commit) via a9879e37d4e3bb714ef6c0c4144c6949daec0b53 (commit) via 0efdbd61bdc2343e5459959b300bccc9986b1d78 (commit) via 3af086398fecb5f7c501190f9620b9c7b201f0ca (commit) via f7f9d0943474cb2de7832d7ca95210ea9e9c772b (commit) via c44b632b010b7d57007f3c8f294271c7e0217e0d (commit) via 0e5cc2a58b0d38e10a2ef9e81dc887c20f3fbdcb (commit) via 1bf289abdd3067a40e9a67091aba78222d13eddf (commit) via 3a7624f9d468b99714a7b6a45313f9e7f66011ed (commit) via aabb2507dacc63ae026e6c99704a2fb79950e82c (commit) via 721a06e28bacf9e03fd8eb4aff53dd17c363ffa1 (commit) via 8a1ae0c5a3aa788ed0f29c264249ba7bc5d226a7 (commit) via 0899f14b1483682d73d1ee2d2419db54ffeadc4b (commit) via 5d0d2b8b528414c859da0e6fd5959321db33608b (commit) via b541194d6075e5db72fb691fb79dc81659771cb1 (commit) via b7c42bff9457ec8294b04245af8e3b6010707d1a (commit) via 2e680e6b421d72cf2d217d3c3c1564da0bb19633 (commit) via 701395087156b2a5c7be1564897b796df35b69ec (commit) via b5e9a4c50eedb8cc786c52af06352788ca25f51e (commit) via 22b14e1a887f0479cc75ed9027af5cc24797f217 (commit) via 68a49739763b7125382186504b9cb9b770cfde0e (commit) via 4ff3b73b1ccb795fac98b26e038f41f5e32f0d6b (commit) via 6034de0e24438e012f9f1d2065531b1ce467ac52 (commit) via ce4fb56c9972a854bd139429b6f4a26e8d5c3956 (commit) from 771b1e9c2e694ccc8825fb8088174c122532e74d (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 113c763f15ab1db3810f40504b60bab5d3f2f212 Merge: 0384f1902bb64d6683b689de226fff4e54331c24 d3dc9410501767c07d9b0106bb73c979d869c127 Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Wed Aug 3 16:56:26 2011 +1000 Merge remote branch 'martins/test_suite' commit 0384f1902bb64d6683b689de226fff4e54331c24 Merge: cc9a09b2cbe300ad5848932b9273270ad50ea6b0 a9879e37d4e3bb714ef6c0c4144c6949daec0b53 Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Wed Aug 3 16:26:43 2011 +1000 Merge remote branch 'martins/onnode_tests' commit cc9a09b2cbe300ad5848932b9273270ad50ea6b0 Merge: 1bf289abdd3067a40e9a67091aba78222d13eddf 3a7624f9d468b99714a7b6a45313f9e7f66011ed Author: Ronnie Sahlberg <ronniesahlb...@gmail.com> Date: Wed Aug 3 16:25:46 2011 +1000 Merge remote branch 'martins/lcp2_sim' commit d3dc9410501767c07d9b0106bb73c979d869c127 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Sep 28 14:37:02 2010 +1000 Test suite: when the cluster flip-flops (un)healthy, using "ctdb status -Y". Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 21cdc7ed6942238faeb42983c862d4abc3f54ffb Author: Martin Schwenke <mar...@meltin.net> Date: Fri Sep 24 14:34:46 2010 +1000 Test suite: Print debug info from cluster nodes when time jumps occur. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit c2efb5897e4258df649149f9904d7ac47322e1b4 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 23 15:01:01 2010 +1000 Test suite: Add debug for cluster (un)healthy flip-flop after restart. We're seeing the cluster become healthy after a restart and then revert to being unhealthy. It looks like there's a race and the cluster shouldn't have been healthy, given that we seem to see that the monitor cycle hasn't yet been run. This collects some state debug info from all nodes after the cluster becomes healthy. This is printed if the cluster is then unexpectedly unhealthy a short time later. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit fed3c2b80b8add8d1cf33abdd5dd8d8001af44d4 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Sep 21 13:34:22 2010 +1000 Test suite: add more debug to time jump post mortem. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 93b53b186df55942bf4d9e90cae329f47889af72 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 9 17:21:11 2010 +1000 Test suite: add automated checking of time logs. This depends on the format of onnode output and also depends on simple/00_ctdb_onnode.sh having been run. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 18db530880849b59445d7aa508bf218bdd77ea1c Author: Martin Schwenke <mar...@meltin.net> Date: Thu Sep 9 15:41:03 2010 +1000 Test suite: make time log use seconds since epoch. Easier to implement automatic checking. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 651e6703b6dc4d11ba7d6d0b44d3be1f485a0f75 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 31 17:48:00 2010 +1000 Test suite: CTDB_SAMBA_SKIP_SHARE_CHECK test now uses _loadconfig(). Signed-off-by: Martin Schwenke <mar...@meltin.net> commit bf23e7166385d305c6860b37c120f70a9aa33aa5 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 31 17:44:05 2010 +1000 Test suite: CTDB_NFS_SKIP_SHARE_CHECK test now uses _loadconfig(). The manual replacement of loadconfig() had bit rotted and no longer worked. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit a6b3a7b7db9aa5fc971aae11b9b012e72c7d240c Author: Martin Schwenke <mar...@meltin.net> Date: Tue Aug 31 17:28:00 2010 +1000 Test suite: make time logging only happen on a real cluster, not local daemons. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 5d82d89ee99f10bead101aebda645a80435ba246 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Aug 30 14:23:29 2010 +1000 Test suite: add time logging. We're seeing some weirdness with CTDB controls timing out. We're wondering if time is jumping forward, so this creates a time log on each node that we can examine later if tests fail weirdly. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit a9879e37d4e3bb714ef6c0c4144c6949daec0b53 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 7 16:17:52 2011 +1000 Tests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/. This sets up a more useful convention and avoids future .gitignore problems. Resolved conflict while cherry-picking this: Don't take the eventscripts files for this branch. We'll put them elsewhere. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 0efdbd61bdc2343e5459959b300bccc9986b1d78 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Jun 7 16:06:42 2011 +1000 Tests: run_tests script no longer prints filename in summary descriptions. If filenames should be printed in descriptions in the summary then the descriptions should include the filename. A better option is to include something more human-readable that makes the test just as easily identifiable. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 3af086398fecb5f7c501190f9620b9c7b201f0ca Author: Martin Schwenke <mar...@meltin.net> Date: Tue Jun 7 16:05:48 2011 +1000 Tests: onnode tests changed to use a simple define_test() function. This makes global changes easier. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit f7f9d0943474cb2de7832d7ca95210ea9e9c772b Author: Martin Schwenke <mar...@meltin.net> Date: Wed May 25 13:44:17 2011 +1000 Tests: add initial onnode tests Add some simple tests for the onnode command. These use fake ssh and ctdb commands that are added to $PATH. The infrastructure used is quite flexible and would allow more complex tests to be written. As-is, these tests expose some bugs in the an older version of onnode that is included so it can be used to validate some of the tests. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit c44b632b010b7d57007f3c8f294271c7e0217e0d Author: Martin Schwenke <mar...@meltin.net> Date: Wed May 25 13:39:11 2011 +1000 Tests: change output format of run_tests script and add -q option Putting PASSED/FAILED on the left makes it easier to scan the results and simplifies the code. Also put starts around the word "*FAILED*" to make it more obvious. Also add a -q option to throw away test output and only display the summary (if -s is also specified). Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 0e5cc2a58b0d38e10a2ef9e81dc887c20f3fbdcb Author: Martin Schwenke <mar...@meltin.net> Date: Mon May 23 15:41:59 2011 +1000 Test suite: add a -d option to the run_tests script. This causes summary lines (when used with -s) to be pretty printed and include the test description. This is the 4th line of the test output - that is, immediately after the header. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 1bf289abdd3067a40e9a67091aba78222d13eddf Author: Martin Schwenke <mar...@meltin.net> Date: Tue Jul 5 15:00:31 2011 +1000 ctdb natgwlist should return non-zero when there is no natgw. This makes it 2, since this error corresponds loosely to ENOENT. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 3a7624f9d468b99714a7b6a45313f9e7f66011ed Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 28 12:09:39 2011 +1000 IP allocation simulation - Pad IPv4 addresses in LCP2 algorithm. This makes IPv4 addresses comparable with IPv6 but reduces the overall effectiveness of the algorithm. The alternative would be to treat these addresses separately while trying to keep all the IPs in overall balance... which is basically the problem that LCP2 solves. :-) Signed-off-by: Martin Schwenke <mar...@meltin.net> commit aabb2507dacc63ae026e6c99704a2fb79950e82c Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jul 25 11:10:09 2011 +1000 IP allocation simulation - make stats label for LCP2 imbalance more meaningful. This time in the stats summary. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 721a06e28bacf9e03fd8eb4aff53dd17c363ffa1 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jul 25 11:04:52 2011 +1000 IP allocation simulation - make stats label for LCP2 imbalance more meaningful. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 8a1ae0c5a3aa788ed0f29c264249ba7bc5d226a7 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jul 25 11:00:43 2011 +1000 IP allocation simulation - add examples. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 0899f14b1483682d73d1ee2d2419db54ffeadc4b Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 22 20:24:28 2011 +1000 IP allocation simulation - tighten up termination condition for -x. When there are IP groups, do not terminate when the overall cluster goes out of balance. Also make explicit that grat_ip_moves is an integer not a boolean, so only terminate if it is greater than 0. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 5d0d2b8b528414c859da0e6fd5959321db33608b Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 22 20:21:46 2011 +1000 IP allocation simulation - fix documentation for diff() function. It had out-of-date information and a typo. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit b541194d6075e5db72fb691fb79dc81659771cb1 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 22 20:20:05 2011 +1000 IP allocation simulation - add mean imbalance statistics. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit b7c42bff9457ec8294b04245af8e3b6010707d1a Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 22 20:15:53 2011 +1000 IP allocation simulation - add -A/--aggressive option. This is likely to cause many more state changes for nodes. In this mode the odds of a failover are applied to determine whether a state change occurs for each node. If no state change occurs then the process is repeated. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 2e680e6b421d72cf2d217d3c3c1564da0bb19633 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 22 20:11:32 2011 +1000 IP allocation simulation - add LCP2 imbalance metric to node state output. Print the LCP imbalance metric after the list of IPs. To make this more sensible, but most of the printing logic into the Node class. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 701395087156b2a5c7be1564897b796df35b69ec Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 22 19:47:40 2011 +1000 IP allocation simulation - add analysis of IP groups. The public addresses passed to the node constructer can be nested 2 levels. Each sub-list is an IP group for which separate balance analysis is done. However, the public address list is flattened and the actual IP assignment algorithm doesn't know about IP groups. This allows extra statistics to be printed and an extra termination condition to be added for unbalanced IP groups. Most code from calculate_imbalance() is factored out to a a new function imbalance_for_ips(), which calculates imbalance for the given IPs. calculate_imbalance() now returns the overall imbalance and a list containing imbalances for each IP group. To support this node_ip_coverage() now takes an optional list of IPs to check coverage within. This also adds extra output to show statistics for the LCP2 imbalance metric. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit b5e9a4c50eedb8cc786c52af06352788ca25f51e Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 21 21:45:46 2011 +1000 IP allocation simulation - add -H/-S options for hard/soft imbalance limit. An imbalance exceeding the hard limit, as specified by -H (and defaulting to 1), now causes termination when -x is specified. Imbalances exceeding the soft limit, as specified by -S (and defaulting to 1), are counted and printed in the statistics summary. A side-effect is that imbalances less than 2 are no longer rounded down to 0, since we want to see them in the stats. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 22b14e1a887f0479cc75ed9027af5cc24797f217 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 21 21:33:40 2011 +1000 IP allocation simulation - add LCP2 algorithm. Add -L/--lcp2 option and implement LCP2 algorithm as an alternative to the basic non-deterministic algorithm. Existing examples will break if used with LCP2 since it needs real IP addresses. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 68a49739763b7125382186504b9cb9b770cfde0e Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 21 16:08:53 2011 +1000 IP allocation simulation - options.exit is boolean, so don't compare with 0. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 4ff3b73b1ccb795fac98b26e038f41f5e32f0d6b Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 21 16:02:07 2011 +1000 IP allocation simulation - remove unused function find_least_loaded_node(). Signed-off-by: Martin Schwenke <mar...@meltin.net> commit 6034de0e24438e012f9f1d2065531b1ce467ac52 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 21 15:55:26 2011 +1000 IP reallocation simulation - remove --hack option. The hacks were attempts at improving the deterministic IPs algorithm but they didn't work. Signed-off-by: Martin Schwenke <mar...@meltin.net> commit ce4fb56c9972a854bd139429b6f4a26e8d5c3956 Author: Martin Schwenke <mar...@meltin.net> Date: Thu Jul 21 15:53:35 2011 +1000 IP allocation simulation - add debug output using -vv. -v can now be provided more than once to increase verbosity. Signed-off-by: Martin Schwenke <mar...@meltin.net> ----------------------------------------------------------------------- Summary of changes: tests/complex/01_ctdb_nfs_skip_share_check.sh | 12 +- tests/complex/02_ctdb_samba_skip_share_check.sh | 12 +- tests/onnode/0001.sh | 24 + tests/onnode/0002.sh | 16 + tests/onnode/0003.sh | 16 + tests/onnode/0004.sh | 16 + tests/onnode/0005.sh | 13 + tests/onnode/0006.sh | 15 + tests/onnode/0070.sh | 32 + tests/onnode/0071.sh | 30 + tests/onnode/0072.sh | 29 + tests/onnode/0075.sh | 29 + tests/onnode/0080.sh | 17 + tests/onnode/0081.sh | 17 + tests/onnode/0090.sh | 21 + tests/onnode/0091.sh | 21 + tests/onnode/README | 38 ++ tests/onnode/common.sh | 103 ++++ tests/onnode/nodes | 4 + tests/onnode/run_tests.sh | 31 + tests/onnode/stubs/ctdb | 33 + .../onnode => tests/onnode/stubs/onnode-buggy-001 | 89 ++-- tests/onnode/stubs/ssh | 2 + tests/scripts/ctdb_test_functions.bash | 61 ++ tests/scripts/run_tests | 44 ++- tests/simple/00_ctdb_onnode.sh | 9 + tests/takeover/ctdb_takeover.py | 636 +++++++++++++++----- tests/takeover/ip_groups1.py | 25 + tests/takeover/ip_groups2.py | 20 + tests/takeover/ip_groups3.py | 27 + tests/takeover/ip_groups4.py | 25 + tests/takeover/ip_groups5.py | 23 + tools/ctdb.c | 3 +- 33 files changed, 1248 insertions(+), 245 deletions(-) create mode 100755 tests/onnode/0001.sh create mode 100755 tests/onnode/0002.sh create mode 100755 tests/onnode/0003.sh create mode 100755 tests/onnode/0004.sh create mode 100755 tests/onnode/0005.sh create mode 100755 tests/onnode/0006.sh create mode 100755 tests/onnode/0070.sh create mode 100755 tests/onnode/0071.sh create mode 100755 tests/onnode/0072.sh create mode 100755 tests/onnode/0075.sh create mode 100755 tests/onnode/0080.sh create mode 100755 tests/onnode/0081.sh create mode 100755 tests/onnode/0090.sh create mode 100755 tests/onnode/0091.sh create mode 100644 tests/onnode/README create mode 100644 tests/onnode/common.sh create mode 100644 tests/onnode/nodes create mode 100755 tests/onnode/run_tests.sh create mode 100755 tests/onnode/stubs/ctdb copy tools/onnode => tests/onnode/stubs/onnode-buggy-001 (87%) create mode 100755 tests/onnode/stubs/ssh create mode 100755 tests/takeover/ip_groups1.py create mode 100755 tests/takeover/ip_groups2.py create mode 100755 tests/takeover/ip_groups3.py create mode 100755 tests/takeover/ip_groups4.py create mode 100755 tests/takeover/ip_groups5.py Changeset truncated at 500 lines: diff --git a/tests/complex/01_ctdb_nfs_skip_share_check.sh b/tests/complex/01_ctdb_nfs_skip_share_check.sh index cd4dec8..85bc64d 100755 --- a/tests/complex/01_ctdb_nfs_skip_share_check.sh +++ b/tests/complex/01_ctdb_nfs_skip_share_check.sh @@ -103,15 +103,9 @@ try_command_on_node $test_node "echo \"function exportfs () { echo $foo_dir 127. n="$rc_local_d/nfs-skip-share-check" n_contents='loadconfig() { - name="$1" - if [ -f /etc/sysconfig/$name ]; then - . /etc/sysconfig/$name - elif [ -f /etc/default/$name ]; then - . /etc/default/$name - elif [ -f $CTDB_BASE/sysconfig/$name ]; then - . $CTDB_BASE/sysconfig/$name - fi - if [ "$name" = "ctdb" ] ; then + _loadconfig "$@" + + if [ "$1" = "ctdb" -o "$1" = "nfs" ] ; then CTDB_NFS_SKIP_SHARE_CHECK=no fi } diff --git a/tests/complex/02_ctdb_samba_skip_share_check.sh b/tests/complex/02_ctdb_samba_skip_share_check.sh index 4cb24d6..c7eadc6 100755 --- a/tests/complex/02_ctdb_samba_skip_share_check.sh +++ b/tests/complex/02_ctdb_samba_skip_share_check.sh @@ -108,15 +108,9 @@ try_command_on_node $test_node "echo 'function testparm () { tp=\$(which testpar n="$rc_local_d/samba-skip-share-check" n_contents='loadconfig() { - name="$1" - if [ -f /etc/sysconfig/$name ]; then - . /etc/sysconfig/$name - elif [ -f /etc/default/$name ]; then - . /etc/default/$name - elif [ -f $CTDB_BASE/sysconfig/$name ]; then - . $CTDB_BASE/sysconfig/$name - fi - if [ "$name" = "ctdb" ] ; then + _loadconfig "$@" + + if [ "$1" = "ctdb" ] ; then CTDB_SAMBA_SKIP_SHARE_CHECK=no fi } diff --git a/tests/onnode/0001.sh b/tests/onnode/0001.sh new file mode 100755 index 0000000..3c2d541 --- /dev/null +++ b/tests/onnode/0001.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE all hostname" + +define_test "$cmd" "all nodes OK" + +required_result <<EOF + +>> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.102 << +-n 192.168.1.102 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0002.sh b/tests/onnode/0002.sh new file mode 100755 index 0000000..b18d91e --- /dev/null +++ b/tests/onnode/0002.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE -q all hostname" + +define_test "$cmd" "all nodes OK" + +required_result <<EOF +-n 192.168.1.101 hostname +-n 192.168.1.102 hostname +-n 192.168.1.103 hostname +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0003.sh b/tests/onnode/0003.sh new file mode 100755 index 0000000..d925799 --- /dev/null +++ b/tests/onnode/0003.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE -p all hostname" + +define_test "$cmd" "all nodes OK" + +required_result <<EOF +[192.168.1.101] -n 192.168.1.101 hostname +[192.168.1.102] -n 192.168.1.102 hostname +[192.168.1.103] -n 192.168.1.103 hostname +[192.168.1.104] -n 192.168.1.104 hostname +EOF + +simple_test -s $cmd diff --git a/tests/onnode/0004.sh b/tests/onnode/0004.sh new file mode 100755 index 0000000..a6e6424 --- /dev/null +++ b/tests/onnode/0004.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE -pq all hostname" + +define_test "$cmd" "all nodes OK" + +required_result <<EOF +-n 192.168.1.101 hostname +-n 192.168.1.102 hostname +-n 192.168.1.103 hostname +-n 192.168.1.104 hostname +EOF + +simple_test -s $cmd diff --git a/tests/onnode/0005.sh b/tests/onnode/0005.sh new file mode 100755 index 0000000..af237da --- /dev/null +++ b/tests/onnode/0005.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE 3 hostname" + +define_test "$cmd" "all nodes OK" + +required_result <<EOF +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0006.sh b/tests/onnode/0006.sh new file mode 100755 index 0000000..aa6eeba --- /dev/null +++ b/tests/onnode/0006.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE -v 3 hostname" + +define_test "$cmd" "all nodes OK" + +required_result <<EOF + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0070.sh b/tests/onnode/0070.sh new file mode 100755 index 0000000..f38c95f --- /dev/null +++ b/tests/onnode/0070.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE ok hostname" + +define_test "$cmd" "all nodes OK" + +ctdb_set_output <<EOF +:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive: +:0:192.168.1.101:0:0:0:0:0:0: +:1:192.168.1.102:0:0:0:0:0:0: +:2:192.168.1.103:0:0:0:0:0:0: +:3:192.168.1.104:0:0:0:0:0:0: +EOF + +required_result <<EOF + +>> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.102 << +-n 192.168.1.102 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0071.sh b/tests/onnode/0071.sh new file mode 100755 index 0000000..8a1cb59 --- /dev/null +++ b/tests/onnode/0071.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE ok hostname" + +define_test "$cmd" "2nd node disconnected" + +ctdb_set_output <<EOF +ctdb_set_output <<EOF +:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive: +:0:192.168.1.101:0:0:0:0:0:0: +:1:192.168.1.102:1:0:0:0:0:0: +:2:192.168.1.103:0:0:0:0:0:0: +:3:192.168.1.104:0:0:0:0:0:0: +EOF + +required_result <<EOF + +>> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0072.sh b/tests/onnode/0072.sh new file mode 100755 index 0000000..d80361a --- /dev/null +++ b/tests/onnode/0072.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE ok hostname" + +define_test "$cmd" "2nd node disconnected, extra status columns" + +ctdb_set_output <<EOF +:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:X1:X2:X3:X4: +:0:192.168.1.101:0:0:0:0:0:0:0:0:0:0: +:1:192.168.1.102:1:0:0:0:0:0:0:0:0:0: +:2:192.168.1.103:0:0:0:0:0:0:0:0:0:0: +:3:192.168.1.104:0:0:0:0:0:0:0:0:0:0: +EOF + +required_result <<EOF + +>> NODE: 192.168.1.101 << +-n 192.168.1.101 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0075.sh b/tests/onnode/0075.sh new file mode 100755 index 0000000..aa2e8be --- /dev/null +++ b/tests/onnode/0075.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE con hostname" + +define_test "$cmd" "1st node disconnected" + +ctdb_set_output <<EOF +:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive: +:0:192.168.1.101:1:0:0:0:0:0: +:1:192.168.1.102:0:0:0:0:0:0: +:2:192.168.1.103:0:0:0:0:0:0: +:3:192.168.1.104:0:0:0:0:0:0: +EOF + +required_result <<EOF + +>> NODE: 192.168.1.102 << +-n 192.168.1.102 hostname + +>> NODE: 192.168.1.103 << +-n 192.168.1.103 hostname + +>> NODE: 192.168.1.104 << +-n 192.168.1.104 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0080.sh b/tests/onnode/0080.sh new file mode 100755 index 0000000..095f65b --- /dev/null +++ b/tests/onnode/0080.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE recmaster hostname" + +define_test "$cmd" "node 1 (192.168.1.102) is recmaster" + +ctdb_set_output <<EOF +1 +EOF + +required_result <<EOF +-n 192.168.1.102 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/0081.sh b/tests/onnode/0081.sh new file mode 100755 index 0000000..e593934 --- /dev/null +++ b/tests/onnode/0081.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE lvsmaster hostname" + +define_test "$cmd" "no lvsmaster" + +ctdb_set_output 255 <<EOF +There is no LVS master +EOF + +required_result 1 <<EOF +onnode: No lvsmaster available +EOF + +simple_test $cmd diff --git a/tests/onnode/0090.sh b/tests/onnode/0090.sh new file mode 100755 index 0000000..1147e34 --- /dev/null +++ b/tests/onnode/0090.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE natgw hostname" + +define_test "$cmd" "no natgw" + +ctdb_set_output <<EOF +-1 0.0.0.0 +:0:192.168.1.101:0:0:0:0:0: +:1:192.168.1.102:0:0:0:0:0: +:2:192.168.1.103:0:0:0:0:0: +:3:192.168.1.104:0:0:0:0:0: +EOF + +required_result 1 <<EOF +onnode: No natgwlist available +EOF + +simple_test $cmd diff --git a/tests/onnode/0091.sh b/tests/onnode/0091.sh new file mode 100755 index 0000000..5239eef --- /dev/null +++ b/tests/onnode/0091.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +. "${ONNODE_TESTS_DIR}/common.sh" + +cmd="$ONNODE natgw hostname" + +define_test "$cmd" "node 2 (192.168.1.103) is natgw" + +ctdb_set_output <<EOF +2 192.168.1.103 +:0:192.168.1.101:0:0:0:0:0: +:1:192.168.1.102:0:0:0:0:0: +:2:192.168.1.103:0:0:0:0:0: +:3:192.168.1.104:0:0:0:0:0: +EOF + +required_result <<EOF +-n 192.168.1.103 hostname +EOF + +simple_test $cmd diff --git a/tests/onnode/README b/tests/onnode/README new file mode 100644 index 0000000..58943d3 --- /dev/null +++ b/tests/onnode/README @@ -0,0 +1,38 @@ +onnode unit tests +================= + +Examples: + +* ./run_tests.sh + + Run all tests, displaying output. + +* ./run_tests.sh -s + + Run all tests, displaying output and a summary. + +* ./run_tests.sh -sq + + Run all tests, displaying only a summary. + +* ONNODE=onnode-buggy-001 ./run_tests.sh -s + + Run against stubs/onnode-buggy-001 instead of default onnode version. + + Add more buggy versions of onnode to this directory as bugs are + fixed to enable test validation using this feature. + +* ./run_tests.sh ./009*.sh + + Run only the specified tests. + +* ONNODE="bash -x stubs/onnode-buggy-001" ./run_tests.sh ./0090.sh + ONNODE="bash -x ../../tools/onnode" ./run_tests.sh ./0090.sh + + Debug the specified test or test failure. The test will fail + because the bash trace output will be included in the test output. + However, this at least makes it easy to trace onnode while running + the test... + + To see if the test pases, the -x can be dropped... so command-line + editing can be kept to a minimum. diff --git a/tests/onnode/common.sh b/tests/onnode/common.sh new file mode 100644 index 0000000..f920bc3 --- /dev/null +++ b/tests/onnode/common.sh @@ -0,0 +1,103 @@ +# Hey Emacs, this is a -*- shell-script -*- !!! :-) + +# Set indirectly by run_tests at top level. +unset CTDB_NODES_SOCKETS + +# Default to just "onnode". +: ${ONNODE:=onnode} + +# Augment PATH with relevant stubs/ directories. + +if [ -d "${ONNODE_TESTS_DIR}/stubs" ] ; then + PATH="${ONNODE_TESTS_DIR}/stubs:$PATH" +fi + +export ONNODE_TESTCASE_DIR=$(dirname "$0") +if [ $(basename "$ONNODE_TESTCASE_DIR") = "onnode" ] ; then + # Just a test script, no testcase subdirectory. + ONNODE_TESTCASE_DIR="$ONNODE_TESTS_DIR" +else + if [ -d "${ONNODE_TESTCASE_DIR}/stubs" ] ; then + PATH="${ONNODE_TESTCASE_DIR}/stubs:$PATH" + fi +fi + -- CTDB repository