summaryrefslogtreecommitdiff
path: root/ctdb/tests
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tests: Use select_test_node() in ctdb setdebug simple testMartin Schwenke2019-08-141-1/+1
| | | | | | | There is no requirement for IP addresses here. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add function select_test_node()Martin Schwenke2019-08-141-0/+8
| | | | | | | Should be used when public IP addresses are not assigned. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Don't print summary on failure if -e option is specifiedMartin Schwenke2019-08-141-4/+6
| | | | | | | | If there is a failure it will always be the last test run. Don't obscure this by following it with a summary. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop mention of non-existent -s optionMartin Schwenke2019-08-141-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add -I <count> option for iterating testsMartin Schwenke2019-08-141-3/+24
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Factor out main test loop into run_tests()Martin Schwenke2019-08-141-24/+33
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add shellcheck test for some test scripts and includesMartin Schwenke2019-08-141-0/+24
| | | | | | | These files now pass, so we might as well keep them in good shape. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: New variable CTDB_SCRIPTS_TESTS_BIN_DIRMartin Schwenke2019-08-141-1/+4
| | | | | | | This can be used to find ctdb_run_tests and ctdb_local_daemons. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Rename CTDB_SCRIPTS_TESTS_BINDIR to CTDB_SCRIPTS_TESTS_LIBEXEC_DIRMartin Schwenke2019-08-142-5/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Simplify test_wrap scriptMartin Schwenke2019-08-141-14/+4
| | | | | | | Given other improvements, this is now needlessly complex. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2045Martin Schwenke2019-08-141-1/+5
| | | | | | | SC2045 Iterating over ls output is fragile. Use globs. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2034Martin Schwenke2019-08-142-1/+1
| | | | | | | SC2034 summary appears unused. Verify use (or export if used externally) Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2230Martin Schwenke2019-08-141-1/+1
| | | | | | | SC2230 which is non-standard... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2188Martin Schwenke2019-08-141-1/+1
| | | | | | | SC2188 This redirection doesn't have a command... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2155Martin Schwenke2019-08-142-4/+6
| | | | | | | | | | | | SC2155 Declare and assign separately to avoid masking return values The wscript changes require an identical change in local_daemons.sh. While touching the lines in wscript, escape the backslashes to make them literal backslashes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2004Martin Schwenke2019-08-141-4/+4
| | | | | | | SC2004 $/${} is unnecessary on arithmetic variables Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2164Martin Schwenke2019-08-141-1/+4
| | | | | | | SC2164 Use 'cd ... || exit' or 'cd ... || return' in case cd fails Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shellcheck warning SC2086Martin Schwenke2019-08-141-6/+7
| | | | | | | SC2086 Double quote to prevent globbing and word splitting Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Drop monitoring of recovery lockMartin Schwenke2019-07-266-87/+0
| | | | | | | The fcntl helper now does a more meaningful check. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add some 01.reclock.script init event testsMartin Schwenke2019-07-263-0/+50
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix 01.reclock.script tests for non-default lockMartin Schwenke2019-07-263-8/+11
| | | | | | | | These tests currently do not do what is expected. They test the default case. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add tests for cluster mutex lost handlingMartin Schwenke2019-07-262-0/+146
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Add support for exiting if the lock file disappearsMartin Schwenke2019-07-261-1/+1
| | | | | | | | | | | | | | | | | If the lock file is inaccessible or the inode number changes then the lock is lost, so exit. This allows the recovery daemon to trigger an election. The ensuing recovery will re-take the lock. By default the lock file is checked every 60 seconds. A lot can happen in 60 seconds but being more aggressive and accessing the lock too often could result in a performance issue for the cluster filesystem. An new optional 2nd argument is added, which is the lock file re-check time in seconds. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Change parent checking to use an asynchronous computationMartin Schwenke2019-07-263-0/+3
| | | | | | | | | Put the checking for the process being immediately re-parented into the computation too. This will be very rare and doing it consistently makes testing saner. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add test to confirm need for cluster mutex lock file recheckingMartin Schwenke2019-07-262-2/+60
| | | | | | | Remove the lock and a second locker can take the it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add cluster mutex testsMartin Schwenke2019-07-264-0/+736
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Set LANG=C for consistency of command outputMartin Schwenke2019-07-261-0/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add tests for empty values in config fileAmitay Isaacs2019-07-261-0/+28
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Use required_error instead of required_resultAmitay Isaacs2019-07-261-3/+3
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Rename local-daemon.sh dump-logs to print-logMartin Schwenke2019-07-051-4/+4
| | | | | | | | | | This makes it consistent with print-socket. 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 Jul 5 06:19:11 UTC 2019 on sn-devel-184
* ctdb-tests: Avoid warning about NULL dereferenceMartin Schwenke2019-07-051-0/+1
| | | | | | | | | Static analysis finds that earlier in the call path, ctdb_string_len() checks for NULL, so complains that a NULL value can be passed to strlen() here. Avoid this by adding an assert(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Don't compare an unsigned value with -1Martin Schwenke2019-07-051-1/+1
| | | | | | | | The dummy reader should never be called, so contains an assert on the buffer length that should always trigger. Just abort() instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix signed/unsigned comparisons by castingMartin Schwenke2019-07-055-6/+6
| | | | | | | | These are all cases comparing a number of bytes written (int or ssize_t) with a size_t, so casting to size_t is appropriate. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix signed/unsigned comparisons by declaring as unsignedMartin Schwenke2019-07-0517-68/+76
| | | | | | | | Change declarations of variable and parameters, usually loop variables and limits, from int to unsigned int, size_t or uint32_t. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix signed/unsigned comparisons by castingMartin Schwenke2019-07-051-19/+19
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add a local variable for repeated calculationMartin Schwenke2019-07-051-8/+10
| | | | | | | | | This improves readability. Also, the asserts involving this expression get more complicated in the next commit, so this will keep those asserts within a single line. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Declare variable for return value of write(2) as ssize_tMartin Schwenke2019-07-051-4/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix signed/unsigned comparison by declaring as unsignedMartin Schwenke2019-07-051-1/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid potentially uninitialised dataMartin Schwenke2019-06-051-2/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix signed/unsigned comparison by using constantMartin Schwenke2019-06-051-1/+1
| | | | | | | Variable reqid is unsigned, so don't compare with -1. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests: Add missing va_end() in ctdb_set_error()Andreas Schneider2019-05-241-0/+1
| | | | | | | Found by csbuild. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Gary Lockyer <gary@samba.org>
* ctdb-tests: Fix logic error in simple ctdb reloadips testMartin Schwenke2019-05-141-17/+20
| | | | | | | | | | | | | | | There is a chance that restoring IP addresses to the test node will result in different IP addresses being assigned to that node. Removing a single IP address may then fail (or be a no-op) if it is done after the restore. So, swap the single IP address removal to happen first, then restore, then remove all IP addresses. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make ctdb reloadips tests more reliableMartin Schwenke2019-05-142-7/+61
| | | | | | | | | | | | ctdb reloadips will fail if it can't disable takover runs. The most likely reason for this is that there is already a takeover run in progress. We can't predict when this will happen, so retry if this occurs. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Capture output in $out on failure as wellMartin Schwenke2019-05-141-3/+5
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Remove old socket wrapper state directory during setupMartin Schwenke2019-05-131-0/+1
| | | | | | | | | | | | | Otherwise, when looping tests for a long time, nodes are unable to connect to each other. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 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 May 13 08:42:44 UTC 2019 on sn-devel-184
* ctdb-tests: Actually restart if cluster doesn't become healthyMartin Schwenke2019-05-131-0/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add dump-logs command for local daemonsMartin Schwenke2019-05-131-0/+27
| | | | | | | Dump a single merged log to stdout. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add reqid wrapping testAmitay Isaacs2019-05-131-0/+16
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13930 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb: Fix format in db_hash_testAndreas Schneider2019-05-071-1/+1
| | | | | | | | | error: ā€˜%04dā€™ directive writing between 4 and 11 bytes into a region of size 5 [-Werror=format-overflow=] sprintf(key, "key%04d", i); Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* ctdb-tests: Fix usage messageMartin Schwenke2019-05-071-1/+1
| | | | | | | | | | | Since commit 0e9ead8f28fced3ebfa888786a1dc5bb59e734a3 daemons have been shut down after each test, so this option no longer has anything to do with killing daemons. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>