summaryrefslogtreecommitdiff
path: root/ctdb/tests
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tests: Clear deleted record via recovery instead of vacuumingMartin Schwenke2019-09-041-12/+5
| | | | | | | | | | | | | | | | | | | This test has been flapping because sometimes the record is not vacuumed within the expected time period, perhaps even because the check for the record can interfere with vacuuming. However, instead of waiting for vacuuming the record can be cleared by doing a recovery. This should be much more reliable. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 RN: Fix flapping CTDB tests Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Wed Aug 21 13:06:57 UTC 2019 on sn-devel-184 (cherry picked from commit 71ad473ba805abe23bbe6c1a1290612e448e73f3)
* ctdb-tests: Strengthen volatile DB traverse testMartin Schwenke2019-09-041-15/+52
| | | | | | | | | | | Check the record count more often, from multiple nodes. Add a case with multiple records. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit ca4df06080709adf0cbebc95b0a70b4090dad5ba)
* ctdb-tests: Don't retrieve the VNN map from target node for notlmasterMartin Schwenke2019-09-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use the VNN map from the node running node_has_status(). This means that wait_until_node_has_status 1 notlmaster 10 0 will run "ctdb status" on node 0 and check (for up to 10 seconds) if node 1 is in the VNN map. If the LMASTER capability has been dropped on node 1 then the above will wait for the VNN map to be updated on node 0. This will happen as part of the recovery that is triggered by the change of LMASTER capability. The next command will then only be able to attach to $TESTDB after the recovery is complete thus guaranteeing a sane state for the test to continue. This stops simple/79_volatile_db_traverse.sh from going into recovery during the traverse or at some other inconvenient time. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 53daeb2f878af1634a26e05cb86d87e2faf20173)
* ctdb-tests: Handle special cases first and returnMartin Schwenke2019-09-041-31/+28
| | | | | | | | | | All the other cases involve matching bits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit bff1a3a548a2cace997b767d78bb824438664cb7)
* ctdb-tests: Inline handling of recovered and notlmaster statusesMartin Schwenke2019-09-041-6/+12
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit bb59073515ee5f7886b5d9a20d7b2805857c2708)
* ctdb-tests: Drop unused node statuses frozen/unfrozenMartin Schwenke2019-09-041-6/+2
| | | | | | | | | | Silently drop unused local variable mpat. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 9b09a87326af28877301ad27bcec5bb13744e2b6)
* ctdb-tests: Reformat node_has_status()Martin Schwenke2019-09-041-46/+48
| | | | | | | | | | Re-indent and drop non-POSIX left-parenthesis from case labels. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 52227d19735a3305ad633672c70385f443f222f0)
* 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>
* ctdb-tests: Wait to allow database attach/detach to take effectMartin Schwenke2019-05-072-36/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the detach test fails: Check detaching single test database detach_test1.tdb BAD: database detach_test1.tdb is still attached Number of databases:4 dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.0/db/volatile/detach_test4.tdb.0 dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.0/db/volatile/detach_test3.tdb.0 dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.0/db/volatile/detach_test2.tdb.0 dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.0/db/volatile/detach_test1.tdb.0 Number of databases:3 dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.1/db/volatile/detach_test4.tdb.1 dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.1/db/volatile/detach_test3.tdb.1 dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.1/db/volatile/detach_test2.tdb.1 Number of databases:4 dbid:0x5ae995ee name:detach_test4.tdb path:tests/var/simple/node.2/db/volatile/detach_test4.tdb.2 dbid:0xd84cc13c name:detach_test3.tdb path:tests/var/simple/node.2/db/volatile/detach_test3.tdb.2 dbid:0x8e8e8cef name:detach_test2.tdb path:tests/var/simple/node.2/db/volatile/detach_test2.tdb.2 dbid:0xc62491f4 name:detach_test1.tdb path:tests/var/simple/node.2/db/volatile/detach_test1.tdb.2 *** TEST COMPLETED (RC=1) AT 2019-04-27 03:35:40, CLEANING UP... When issued from a client, the detach control re-broadcasts itself asynchronously to all nodes and then returns success. The controls to some nodes to do the actual detach may still be in flight when success is returned to the client. Therefore, the test should wait for a few seconds to allow the asynchronous controls to complete. The same is true for the attach control, so workaround the problem in the attach test too. An alternative is to make the attach and detach controls synchronous by avoiding the broadcast and waiting for the results of the individual controls sent to the nodes. However, a simple implementation would involve adding new nested event loops. 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: Avoid bulk output in $out, prefer $outfileMartin Schwenke2019-05-0738-190/+161
| | | | | | | 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 try_command_on_node less error-proneMartin Schwenke2019-05-071-8/+22
| | | | | | | | | | | | | | | | | | | This sometimes fails, apparently due to a cat process in onnode getting EAGAIN. The conclusion is that tests that process large amounts of output should not depend on a sub-shell delivering that output into a shell variable. Change try_command_on_node() to leave all of the output in file $outfile and just put the first 1KB into $out. $outfile is removed after each test completes. Change the implementation of sanity_check_output() to use $outfile instead of $out. 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: Change sanity_check_output() to internally use $outMartin Schwenke2019-05-0711-21/+15
| | | | | | | | | | | All callers are currently passed $out. Global variable $out is used in many other places so use it here to simplify the interface and make future changes simpler. 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-scripts: Drop script configuration variable CTDB_MONITOR_SWAP_USAGEMartin Schwenke2019-05-078-137/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CTDB's system memory monitoring in 05.system.script monitors both main memory and swap. The swap monitoring was originally based on the (possibly incorrect, see below) idea that swap space stacks on top of main memory, so that when a system starts filling swap space then this is supposed to be a good sign that the system is running out of memory. Additionally, performance on a Linux system tends to be destroyed by the I/O associated with a lot of swapping to spinning disks. However, some platforms default to creating only 4GB of swap space even when there is 128GB of main memory. With such a small swap to main memory ratio, memory pressure can force swap to be nearly full even when a significant amount of main memory is still available and the system is performing well. This suggests that checking swap utilisation might be less than useful in many circumstances. So, remove the separate swap space checking and change the memory check to cover the total of main memory and swap space. Test function set_mem_usage() still takes an argument for each of main memory and swap space utilisation. For simplicity, the same number is now passed twice to make the intended results comprehensible. This could be changed later. A couple of tests are cleaned up to no longer use hard-coded /proc/meminfo and ps output. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Extend test to cover ctdb rddumpmemoryMartin Schwenke2019-05-071-2/+5
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13923 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-test: Adding test case to verify queue resizeingSwen Schillig2019-04-102-0/+75
| | | | | | | | | | | | | | If a data packet arrives which exceeds the queue's current buffer size, the buffer needs to be increased to hold the full packet. Once the packet is processed the buffer size should be decreased to its standard size again. This test case verifies this process. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Christof Schmitt <cs@samba.org> Autobuild-User(master): Christof Schmitt <cs@samba.org> Autobuild-Date(master): Wed Apr 10 00:17:37 UTC 2019 on sn-devel-144
* ctdb-test: Adding test case verifying data in buffer moveSwen Schillig2019-04-092-0/+77
| | | | | | Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Christof Schmitt <cs@samba.org>
* ctdb-test: Modify ctdb_io_test test_setup to provide queue referenceSwen Schillig2019-04-091-3/+7
| | | | | | | | | Some test scenarios require access to the created queue. Prepare the test_setup function to provide it as additional parameter. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Christof Schmitt <cs@samba.org>
* ctdb-scripts: Default to using systemd services in NFS call-outMartin Schwenke2019-03-311-1/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: Update NFS test infrastructure to support systemd servicesMartin Schwenke2019-03-311-6/+93
| | | | | | | | | | The tests are written around the default of sysvinit-redhat. Add support for systemd-redhat. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: Add a test for version consistency checkingMartin Schwenke2019-03-151-0/+65
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-daemon: Add an environment variable to set versionMartin Schwenke2019-03-151-0/+11
| | | | | | | | This can be used to test the version checking logic. Cache the version to avoid re-checking the environment variable each time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: Fix remaining common.sh ShellCheck hitsMartin Schwenke2019-03-151-4/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: Shell cleanups in wait_until() functionMartin Schwenke2019-03-151-31/+30
| | | | | | | | | | | This file is included by local_daemons.sh, which is not a bash script and wait_until() uses the "local" keyword. Prefixing variable names with '_' to indicate that they are local changes a lot of lines in this function. So, fix indentation, potential quoting problems and other ShellCheck hits while touching this function. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: export CTDB_SCRIPTS_TOOLS_BIN_DIRMartin Schwenke2019-03-151-0/+1
| | | | | | | | This isn't used anywhere that requires it to be exported, but the lack of consistency will cause problems and confusion at some later stage. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsingMartin Schwenke2019-03-151-0/+19
| | | | | | | | | | | | | ctdb_sock_addr values are hashed in some contexts. This means that all of the memory used for the ctdb_sock_addr should be consistent regardless of how parsing is done. The first 2 cases are just sanity checks but the 3rd case involving an IPv4-mapped IPv6 address is the real target of this test addition. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13839 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: Build cluster mutex path manuallyMartin Schwenke2019-03-151-1/+2
| | | | | | | | | | | CTDB_CLUSTER_MUTEX_HELPER can't be depended on because it is only set when the tests are not installed and setting it unconditionally for this particular use would be wrong. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@samba.org>
* ctdb-tests: Add a test for configuring the recovery lock as a commandMartin Schwenke2019-02-252-0/+31
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add -R option for local daemons to use recovery lock commandMartin Schwenke2019-02-251-2/+10
| | | | | | | | | | Under the covers, a command is always used. However, there is no way of testing of the code path where a command is explicitly configured. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Force test failure if local daemon setup failsMartin Schwenke2019-02-251-0/+3
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add test for ctdb_io.cChristof Schmitt2019-02-222-0/+204
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13791 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Feb 22 03:51:37 CET 2019 on sn-devel-144