summaryrefslogtreecommitdiff
path: root/ctdb/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* ctdb: Use C99 initializer for poptOption in test_optionsAndreas Schneider2019-01-281-26/+79
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ctdb-tests: Minimise chances of test interfering with itselfMartin Schwenke2018-12-181-2/+3
| | | | | | | | | | Checking that the database contains 0 records cause a traverse. This may take a lock and cause vacuuming to fail (or be deferred for a particular record/chain). Minimise the chance of this happening by only checking for 0 records every 10 seconds. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Do not force TEST_VAR_DIR to be absoluteMartin Schwenke2018-12-181-4/+0
| | | | | | | | | | This can result in Unix domain socket names that are too long. 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 18 05:31:00 CET 2018 on sn-devel-144
* ctdb-tests: Force symbolic link targets to be absoluteMartin Schwenke2018-12-181-2/+3
| | | | | | | | | | | If CTDB_BASE is relative then the symbolic link target will be incorrect. Don't force CTDB_BASE to be absolute because this can result in Unix domain socket names that are too long. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-event: Force EVENTSCRIPTS_TESTS_VAR_DIR to be absoluteMartin Schwenke2018-12-181-0/+3
| | | | | | | | | | | | Event scripts (well, statd_callout) can change directory, causing stubs to be unable to locate EVENTSCRIPTS_TESTS_VAR_DIR if it is relative. Don't force TEST_VAR_DIR to be absolute because this can result in Unix domain socket names that are too long. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-event: Force script directory to be absoluteMartin Schwenke2018-12-181-0/+2
| | | | | | | | | | | If TEST_VAR_DIR is relative then symbolic link targets will be incorrect. Don't force TEST_VAR_DIR to be absolute because this can result in Unix domain socket names that are too long. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make the debug hung script test cope with unreadable stacksMartin Schwenke2018-11-151-3/+14
| | | | | | | | | | | | | | | | | | Ideally this would just involve using "test -r". However, operating system security features may mean that kernel stacks are not readable even though they appear to be. Instead, try reading that stack of a process on the test node. If that succeeds then so should reading the stack of the "stuck" sleep process in the test. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13684 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Tim Beale <timbeale@catalyst.net.nz> Autobuild-User(master): Tim Beale <timbeale@samba.org> Autobuild-Date(master): Thu Nov 15 08:15:32 CET 2018 on sn-devel-144
* debug: Use debuglevel_(get|set) functionAndreas Schneider2018-11-083-3/+3
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 8 11:03:11 CET 2018 on sn-devel-144
* ctdb-daemon: Do not fork when CTDB_TEST_MODE is setMartin Schwenke2018-11-061-1/+1
| | | | | | | | | | | | | | Explicitly background ctdbd instead. This has the advantage of leaving stdin open. ctdbd can then be enhanced to exit when stdin closes, allowing better cleanup in a test environment. 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 Nov 6 10:30:14 CET 2018 on sn-devel-144
* ctdb-tests: Add local_daemons.sh onnode and socket commandsMartin Schwenke2018-11-061-0/+44
| | | | | | | | | These aren't used by simple tests but they will be useful for integrating ctdbd local daemons into other test suites and for debugging. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use local_daemons.sh in local_daemons.bashMartin Schwenke2018-11-063-206/+26
| | | | | | | | | The etc-ctdb/ subdirectory containing the event script moves into the top-level tests/ directory because the subdirectory is really now owned by local_daemons.sh instead of simple/. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add local_daemons.shMartin Schwenke2018-11-061-0/+385
| | | | | | | | | | | This provides a separate script for handling local daemons. It can be used for testing outside of the CTDB simple test suite. It is installed as ctdb_local_daemons. The logic is copied from ctdb/tests/simple/scripts/local_daemons.bash. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Allow use of setup_ctdb_base() outside of test casesMartin Schwenke2018-11-061-0/+6
| | | | | | | | Always create an empty event script directory. If $TEST_SUBDIR is unset then don't use it to look for etc-ctdb/. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move setting of ctdb_dir and top_dirMartin Schwenke2018-11-062-20/+12
| | | | | | | These are only used in script_install_paths.sh. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use $CTDB_SCRIPTS_TOOLS_BIN_DIRMartin Schwenke2018-11-061-5/+4
| | | | | | | | | Don't calculate this locally as _tools_dir. Add it to PATH unconditionally - this may result in duplicate entries in PATH but the resulting code is simpler. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use $CTDB_SCRIPTS_TESTS_BINDIRMartin Schwenke2018-11-061-17/+7
| | | | | | | | | | | | Don't calculate this locally as _test_bin_dir. Just calculate top_dir, source script_install_paths.sh and use $CTDB_SCRIPT_TESTS_BINDIR. Don't bother sanity checking if TEST_BIN_DIR is set. It will go away soon. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add new variable CTDB_SCRIPTS_TESTS_BINDIRMartin Schwenke2018-11-061-1/+4
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Change all cluster setup to use ctdb_test_init()Martin Schwenke2018-11-063-28/+7
| | | | | | | | | | | ctdb_test_init() now passes any arguments to setup_ctdb(). Update tests that have custom local daemon configuration to call ctdb_test_init() directly. Remove the redundant, initial call to ctdb_test_init() to avoid starting the cluster an extra time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop passing of test arguments to ctdb_test_init()Martin Schwenke2018-11-0665-65/+65
| | | | | | | Arguments are currently ignored anyway. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop ctdb_restart_when_done()Martin Schwenke2018-11-0646-138/+0
| | | | | | | | This no longer does anything. Integration test cases now start and shut down the cluster. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop dependency on variable ctdb_test_restart_scheduledMartin Schwenke2018-11-061-13/+14
| | | | | | | | | | | The remainder of the scheduled restart logic is about to be removed, so produce debugging information any time the cluster is not healthy. While here, reindent and drop the else since there is already an early return before it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop tests that only start and stop daemonsMartin Schwenke2018-11-063-80/+0
| | | | | | | Integration test cases now start and shut down the cluster. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move enabling of event scripts to setup_ctdb()Martin Schwenke2018-11-063-8/+1
| | | | | | | This is for the real cluster case. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Improve signal handling trapMartin Schwenke2018-11-061-1/+2
| | | | | | | | | | Interrupting a test run currently moves on to the next test. It should exit. Follow the practice of exiting with 128 + signal number. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop cleanup_handler()Martin Schwenke2018-11-061-12/+1
| | | | | | | | | | Running testsuite-specific code here isn't a good option. Daemons are now shut down in ctdb_test_exit(), even when testing is interrupted. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Start daemons in ctdb_test_init(), stop them in ctdb_test_exit()Martin Schwenke2018-11-061-18/+14
| | | | | | | | | | | This makes tests self-contained. They can also now be individually looped, if necessary. Most tests (all but 1 complex, more than 50% of simple) restart the daemons anyway, so this simplification is worth it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Ignore SIGPIPE during simple test cleanupMartin Schwenke2018-11-061-0/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop setting of unused variable scriptnameMartin Schwenke2018-11-061-1/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop use of confusing testfailures variableMartin Schwenke2018-11-0614-50/+27
| | | | | | | | Exit on first test failure instead of setting a variable. The bizarre logic in ctdb_test_exit() makes this worth dropping. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop useless "ctdb version" testMartin Schwenke2018-11-061-54/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Rationalise tunable simple testsMartin Schwenke2018-11-063-117/+24
| | | | | | | | These 3 tests duplicate various checks and can easily be handled as a single test. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Rationalise ctdb stop/continue/disable/enable simple testsMartin Schwenke2018-11-064-88/+2
| | | | | | | | The "continue" and "enable" tests are just extensions of the "stop" and "disable" tests, so drop the latter 2. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use wait_until_node_has_no_ips() in some testsMartin Schwenke2018-11-062-4/+2
| | | | | | | | This strengthens those tests to ensure that released IPs aren't replaced with others. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add function wait_until_node_has_no_ips()Martin Schwenke2018-11-061-0/+7
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Detect unknown node numberMartin Schwenke2018-11-062-0/+26
| | | | | | | | | If there aren't enough addresses in the list then the shift will silently fail and the printed address will be the unshifted value of $1, which is incorrect/unexpected. So, sanity check the node number. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: README updatesMartin Schwenke2018-11-061-2/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Remove export of CTDB_SOCKETMartin Schwenke2018-11-062-2/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use path_socket() in dummy clientMartin Schwenke2018-11-061-13/+10
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop incorrect comment, unused functionMartin Schwenke2018-11-061-7/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop setting of CTDB_SOCKET and CTDB_PIDFILEMartin Schwenke2018-11-061-3/+0
| | | | | | | | | The local daemons ssh stub doesn't need to do this because the ctdbd and the ctdb tool now only need CTDB_TEST_MODE and CTDB_BASE for local daemon tests. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use path_socket() in test client toolsMartin Schwenke2018-11-061-8/+5
| | | | | | | | | Just leak the memory allocated by path_socket(). This is only used in short-lived test programs, so it isn't worth the hassle of plumbing a talloc context through several layers to get here. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use ctdb-path for fake_ctdbd directory setupMartin Schwenke2018-11-062-7/+13
| | | | | | | | This needs to be done before any of the code changes are made, including updating the ctdb tool. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use ctdb-path-like values for local daemons socket and PID fileMartin Schwenke2018-11-061-2/+2
| | | | | | | | | | | | | | However, don't use ctdb-path itself because some tests use nested instances of onnode. The outermost instance would set CTDB_SOCKET and any inner instance would pick up that value, regardless of CTDB_BASE. This is a temporary measure to avoid breaking testing while use of the path functions is added to ctdbd and the ctdb tool. When this is complete these variables can be removed altogether because the code will just depend on CTDB_TEST_MODE and CTDB_BASE. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Improve counting of database recordsMartin Schwenke2018-10-081-3/+7
| | | | | | | | | | | | | | | | | | | Record counts are sometimes incomplete for large databases when relevant tests are run on a real cluster. This probably has something to do with ssh, pipes and buffering, so move the filtering and counting to the remote end. This means that only the count comes across the pipe, instead of all the record data. Instead of explicitly excluding the key for persistent database sequence numbers, just exclude any key starting with '_'. Such keys are not used in tests. 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): Mon Oct 8 05:36:11 CEST 2018 on sn-devel-144
* ctdb-tests: Add extra debug to large database recovery testMartin Schwenke2018-10-081-6/+26
| | | | | | | | | This test sometimes fails, probably because the test is flakey. Either the records aren't being added correctly or the counting of records loses records. Try to debug both possibilities. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Shut down transaction_loop clients more cleanlyMartin Schwenke2018-10-081-10/+18
| | | | | | | | | | | | | A transaction_loop client can exit with a transaction active when its time limit expires. This causes a recovery and causes problems with the test cleanup, which detects unwanted recoveries and fails. Set a flag when the time limit expires and exit cleanly before the next transaction is started. Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Support closing of stdin in local daemons ssh stubMartin Schwenke2018-10-081-3/+8
| | | | | | | Not sure this is needed but this makes it behave the same as ssh. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Be more careful when building public IP addressesMartin Schwenke2018-10-081-7/+9
| | | | | | | | | | | | | | | | The goal is to allow more local daemons by expanding the address range rather than generating invalid addresses. For IPv6, use a separate address space instead of an offset for the 2nd address. For IPv4, use the last 2 octets with addresses starting at 192.168.100.1 and 192.168.200.1. Avoid addresses with 0 and 255 in the last octet by using a maximum of 100 addresses per "subnet" starting at .1. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Be more careful when building node addressesMartin Schwenke2018-10-081-5/+6
| | | | | | | | | | | | | | | | The goal is to allow more local daemons by expanding the address range rather than generating invalid addresses. For IPv6, use all 4 trailing hex digits. For IPv4, use the last 2 octets. Although 127.0.0.0 is a /8 network, avoid unexpected issues due to 0 and 255 in the last octet. Use a maximum of 100 addresses per "subnet" starting at .1. Keep the first group of addresses in 127.0.0.0/24 to continue to allow a reasonable number of nodes to be tested with socket-wrapper. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Don't format IPv4 octets as hex digitsMartin Schwenke2018-10-081-2/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>