summaryrefslogtreecommitdiffstats
path: root/ctdb/tests
Commit message (Collapse)AuthorAgeFilesLines
* ctdb/tests/eventscripts: Avoid errors on broken pipeMartin Schwenke2014-01-311-3/+3
| | | | | | | | | | | ctdb_get_my_public_addresses() attempts to echo things and this causes an error if head has taken the first line and the pipe is closed. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Jan 31 05:30:38 CET 2014 on sn-devel-104
* ctdb/tests/eventscripts: Improve ip command stub secondary handlingMartin Schwenke2014-01-311-22/+59
| | | | | | | | It should support primary and secondaries per network instead of per interface. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb/eventscripts: Print a count if killing TCP connections times outMartin Schwenke2014-01-171-1/+1
| | | | | | | Also update related test Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb/eventscripts: Reconfigure lock should be released quicklyMartin Schwenke2014-01-173-3/+3
| | | | | | | | | | | | | | | Currently the lock is held until the corresponding eventscript completes, since the process still exists. If the regular part of an eventscript hangs then the lock might unnecessarily be held for a long time. The pathological case is when a monitor event gets stuck in D-wait state and the script times out but can't be killed so the lock is still held. This can cause an unwanted monitor replay. Change this so that the lock is released immediately after the reconfiguration is complete. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Set CTDB_EVENT_HELPER when running with local daemonsAmitay Isaacs2014-01-161-0/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/eventscripts: Do not reconfigure in "monitor" eventsMartin Schwenke2013-12-174-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "monitor" events can be cancelled. If a reconfigure action does a service restart then the "monitor" event can be cancelled at the inconvenient moment after the service is stopped. In this case the service stays down and the node may become unhealthy (depending on whether there are any repair actions in the monitor event). A long time ago we did service reconfiguration in "monitor" events following failovers. Service reconfiguration was then moved to the "ipreallocated" event. However, reconfiguration in "monitor" events has been kept as a last resort in case an "ipreallocate" event does not occur. The only important case that this covers is "ctdb deleteip", where "releaseip" events are generated without a corresponding "ipreallocated". Therefore, IPs can be deleted without running the required service reconfiguration. The supported way of removing IP addresses is now via "ctdb reloadips", which always causes a takeover run with a corresponding "ipreallocate" event. This means that service reconfiguration in "monitor" events is no longer required and should be removed because it is unsafe. Also update the associated tests. Make the first confirm that the monitor event no longer does reconfiguration. Change the others to test that monitor status is correctly replayed when something else is doing a reconfigure and currently holds the reconfigure lock. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Tue Dec 17 06:32:35 CET 2013 on sn-devel-104
* ctdb:tests: update READMEMichael Adam2013-12-051-5/+23
| | | | | | | | explain how to run individual tests and test collections and remove mention of tests/scripts/run_tests which does not exist any more. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/tests/scripts: Promote scripts/run_testsMartin Schwenke2013-12-052-317/+304
| | | | | | | The wrapper is not needed anymore. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/scripts: Simplify the top-level test scriptsMartin Schwenke2013-12-052-46/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment run_tests.sh has quite fragile argument processing. It needs that annoying "--" between options and tests. The random default (mktemp -d) for TEST_VAR_DIR is wrong and is worked around in various places. Instead: * Change the default behaviour to print a summary, add new option -N to turn off summary, and remove old -s option. * Change the default behaviour to run integration tests with local daemons, add new options -c to run on a cluster, remove old -l option. * Make $testdir/var the default if the tests are not installed, and $(mktemp -d ) the default if tests are installed. * Move the default tests for local/cluster into scripts/run_tests. run_tests.sh (and the run_cluster_tests.sh symlink) should behave as before but with slightly more reasonable defaults. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/scripts: Sort command-line optionsMartin Schwenke2013-12-051-16/+16
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/integration: Decentralise the daemon restart codeMartin Schwenke2013-12-052-7/+14
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/integration: Update daemons shutdown pseudo-testMartin Schwenke2013-12-053-3/+16
| | | | | | | | Don't scatter the TEST_LOCAL_DAEMONS logic around the code. Limit it to the local daemons file. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/simple: Local daemons version of setup_ctdb() overridesMartin Schwenke2013-12-052-4/+3
| | | | | | | | setup_ctdb() doesn't need to do anything on a cluster. To avoid a conditional, just override it for local daemons. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/integration: Remove some unused functionsMartin Schwenke2013-12-051-43/+0
| | | | | | | This was the start of some refactorisation that was never completed. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/integration: Remove the time logging codeMartin Schwenke2013-12-052-62/+0
| | | | | | | | This hasn't been required for a long time and is probably broken. If it is needed in future then we know where to find it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/simple: Move the local daemons code to its own fileMartin Schwenke2013-12-053-124/+125
| | | | | | | This is just a straight move. The clever stuff will follow. :-) Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb/tests/integration: Update NFS tickles test and supporting codeMartin Schwenke2013-12-052-176/+17
| | | | | | | | | | | | | | | This currently requires an eventscript to be dynamically installed. This eventscript is only used to help determine when a monitor event has occurred. This code is horrible and fragile. A better way is to just monitor the output of "ctdb scriptstatus". When changes it changes then a monitor event has occurred. Also remove the old code that checks for tickle information in shared storage. CTDB hasn't done things this way for a long time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb:tests: in the stub "ip link show" command use echo instead of catMichael Adam2013-11-281-4/+2
| | | | | | | | | | | | This case of "ip link show" does not break autobuild with "Broken pipe" messages, but let's be consistent. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Nov 28 09:23:03 CET 2013 on sn-devel-104
* ctdb:test: remove unused ip2ipmask from integration.bashMichael Adam2013-11-281-7/+0
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests:76_ctdb_pdb_recovery: change from using ctdb pstore to ctdb ptrans.Michael Adam2013-11-281-4/+2
| | | | | | | | | | This removes the requirement to create a temporary file and hence makes this test runnable against local daemons and against a real cluster without further changes. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests:76_ctdb_pdb_recovery: fix a typo in a messageMichael Adam2013-11-281-1/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests:76_ctdb_pdb_recovery: fix a typo in a messageMichael Adam2013-11-281-1/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests: in the stub ip command, avoid broken pipe by using echo instead ↵Michael Adam2013-11-281-9/+3
| | | | | | | | | | | | of cat This fixes running "make autotest" from autobuild, since it prevents irritating error output in delete_ip_from_iface() when calling ip addr list ... | grep -Fq "inet ..." . Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests: ignore SIGPIPE in unit testsMichael Adam2013-11-281-0/+2
| | | | | | | | | | | This makes scripts called in the unit tests behave like when called from ctdbd which ignodes SIGPIPE. This also makes the scrips behave the same when called from "make autotest" directly and via autobuild (python). Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests: add path of ip command to extra output in the error caseMichael Adam2013-11-281-0/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests: remove old now unused script test/recover.shMichael Adam2013-11-281-107/+0
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb:tests/simple: Nobody looks at /tmp/recloop.out so use /dev/null insteadMartin Schwenke2013-11-271-1/+1
| | | | | | | | | | | Otherwise this should use mktemp, something should look at the output and the file should be removed. :-) Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Nov 27 20:39:00 CET 2013 on sn-devel-104
* ctdb:tests: run_tests should ignore bogus test directoriesMartin Schwenke2013-11-271-0/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb:tests: Add -S option to support socket wrapperMartin Schwenke2013-11-271-1/+9
| | | | | | | | Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb:tests: Rework unit test result filteringMartin Schwenke2013-11-274-19/+18
| | | | | | | Using a variable is too fragile, so use a function instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb:tests: remove unused setup_nmap_output_filter()Martin Schwenke2013-11-271-5/+0
| | | | | | | The tests that used it have gone. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb:tests/integration: Be more careful when killing ctdbdMartin Schwenke2013-11-271-1/+1
| | | | | | | | Also match $TEST_VAR_DIR in the socket name. This means that we'll only ever kill ctdbd process belong to our own test run. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests/integration: Neaten up some of the persistent database testsMartin Schwenke2013-11-274-150/+171
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests/takeover: Fix bogus test descriptionMartin Schwenke2013-11-271-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests/simple: User sleep_for() instead of sleepMartin Schwenke2013-11-271-2/+2
| | | | | | | Progress... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests/simple: Update persistent DB testsMartin Schwenke2013-11-273-13/+13
| | | | | | | | | | | * Low level DB checks should ignore the sequence number record. * A restart is needed after messing with the RecoverPDBBySeqNum tunable. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tools/ctdb: New ptrans commandMartin Schwenke2013-11-271-0/+127
| | | | | | | | Also add test. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests/integration: try_command_on_node() shouldn't lose onnode optionsMartin Schwenke2013-11-271-1/+1
| | | | | | | | Currently it only passes the last (non -v) option seen. It should pass them all. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests: CTDB tool should always be invoked as $CTDB instad of ctdbAmitay Isaacs2013-11-277-92/+92
| | | | | | | | $CTDB_TEST_WRAPPER is required only to run test functions or test binaries on remote nodes. For running ctdb command, $CTDB is sufficient. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests: No need to run onnode in parallel for single nodeAmitay Isaacs2013-11-273-6/+6
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests: Remove -q option to try_command_on_nodeAmitay Isaacs2013-11-2712-99/+99
| | | | | | | This option is always passed to onnode by default. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests: Coverity fixesAmitay Isaacs2013-11-191-8/+14
| | | | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Tue Nov 19 19:06:51 CET 2013 on sn-devel-104
* tests: Fix calling of ctdb tool from testAmitay Isaacs2013-11-071-1/+1
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 9381c33dfd40192b7532d942059c2959dfae059d)
* Revert "tests: If transaction_start fails, try again"Amitay Isaacs2013-11-071-1/+1
| | | | | | | | | | | | This reverts commit ed7d999214ee009e480c26410a04fa105028cb8e. This is not necessary since ctdb_transaction_start() now will return NULL only when there is a failure and not when another transaction is currently active. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 46615c8e0e63291605d76a6d35f1a93180718c36)
* tests/complex: Remove CTDB_NFS_SKIP_SHARE_CHECK testMartin Schwenke2013-10-291-129/+0
| | | | | | | | | | This is a needlessly complex way of testing the same thing as the eventscripts unit tests 60.nfs.monitor.161.sh and 60.nfs.monitor.162.sh. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d1674aad224f8f0c9a03c3cd38a647318ba0f03e)
* tests/complex: Remove CTDB_SAMBA_SKIP_SHARE_CHECK testMartin Schwenke2013-10-291-134/+0
| | | | | | | | | | | | | | This is adequately covered by eventscripts unit tests 50.samba.monitor.105.sh and 50.samba.monitor.106.sh. This test is broken if CTDB_SAMBA_CHECK_PORTS is not specified in the CTDB configuration. Fixing it is hard and involves adding a more complex stub for testparm. We already have that in the eventscript unit tests above. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 81b94fbb7495ac3204f1a84c673c8babf04663bc)
* eventscripts: Rewrite the smb.conf cache file handlingMartin Schwenke2013-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The background update is never guaranteed to complete before the cache is used, so don't bother trying it at the beginning. Instead, put a timeout on a foreground update. If the foreground update fails: * If there's no available cache file then die. * If there is a previous cache file then use it and log a warning. * Do a background update at the end of the monitor event. Also remove commas in the "smb ports" list before use, since (newer?) testparm seem to insert commas into the default value. Update the associated test to add a comma. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 8c6f511254ecb0381a609b37e3a0ee6e5ec5d562)
* tools/onnode: Fix healthy/ok node handlingMartin Schwenke2013-10-293-17/+16
| | | | | | | | | | | | | | | | | | | | | | | This bit-rotted a long time ago when the "ThisNode" column was added to "ctdb -Y status" output. The fake "ctdb -Y status" output in the test was never updated to reflect this change. Instead of making sure that all columns are "0", just check that they're not "1". This implicitly ignores "Y" and "N" in this "ThisNode" column without having to do anything else clever. Also update associated tests. The main "ctdb ok" test had a duplicate opening line for a here document, which was tickled by this change. This fixes samba bz#8122. Signed-off-by: Martin Schwenke <martin@meltin.net> onnode test fixup Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 01a46205c3a3d6609dc0b0324319b89667dffa32)
* build: Move the default CTDB socket from /tmp to /var/run/ctdbAmitay Isaacs2013-10-251-4/+0
| | | | | | | | | | | | | | | | | Use /var/run/ctdb/ctdbd.socket because there might be other daemons that need sockets in the future. The local daemons test code to create a link for the default convenience socket has to be removed because the link can't be created as a regular user in the new location. This should be OK since all calls to the ctdb tool in the test code should be wrapped in onnode. When debugging tests, a developer will have to set CTDB_SOCKET by hand. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-programmed-with: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit dc67a4e24af9d07aead2a1710eeaf5d6cc409201)
* common: New function mkdir_p()Martin Schwenke2013-10-251-4/+0
| | | | | | | | | Behaves like mkdir -p. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit afe2145d91725daf1399f0a24f1cddcf65f0ec31)