summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tests: Rename functions to test_header() and test_footer()Martin Schwenke2019-10-041-4/+4
| | | | | | | | | | That's all they do now. 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 Oct 4 10:58:10 UTC 2019 on sn-devel-184
* ctdb-tests: Move test duration calculation to ctdb_test_run()Martin Schwenke2019-10-041-11/+13
| | | | | | | | | | It makes sense to do this in one place in case other headers/footers are added. Reindent ctdb_test_begin() while touching this function. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add handling for skipped testsMartin Schwenke2019-10-042-2/+13
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add a special failure code when a test error occursMartin Schwenke2019-10-042-2/+6
| | | | | | | Use it when a test is not executable. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move test status interpretation to ctdb_test_run()Martin Schwenke2019-10-041-37/+39
| | | | | | | | | | | It makes sense to do this in one place in case other headers/footers are added. Simplify ctdb_test_end() accordingly, reindenting because nearly all lines are modified. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move use of show_progress() into ctdb_test_run()Martin Schwenke2019-10-041-2/+3
| | | | | | | | This allows more variables to be set in this function because they are no longer in a sub-shell. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Simplify ctdb_test_run()Martin Schwenke2019-10-041-13/+11
| | | | | | | | | Only the test file name is ever passed. Reindent while touching many existing lines. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch TEST_CLEANUP and TEST_TIMEOUT to script variablesMartin Schwenke2019-10-041-6/+6
| | | | | | | | These are not used outside this script so they do not need to be environment variables. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add new test functions for running commands on nodesMartin Schwenke2019-10-041-0/+40
| | | | | | | | | | | | | | | | * ctdb_onnode() * testprog_onnode() * function_onnode() These encapsulate familiar patterns found when running try_command_on_node(). The new function names are more concise and encourage more readable tests. Test writers can do less thinking about the subtleties of running different types of commands on nodes. For example, these functions ensure that $CTDB and $VALGRIND are used in the correct contexts. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: try_command_on_node() should return status of commandMartin Schwenke2019-10-041-1/+1
| | | | | | | | There is no point folding this down to 1. Tests should be able to see the original value, if required. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop unused function ctdb_test_check_real_cluster()Martin Schwenke2019-10-041-15/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Update preamble for CLUSTER testsMartin Schwenke2019-10-0416-370/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | The main change is to source cluster.bash instead of integration.bash. While touching the preamble, the following additional changes are also made: * Drop test_info() definition and replace it with a comment The use of test_info() is pointless. * Drop call to ctdb_test_check_real_cluster() cluster.bash now does this. * Drop call to cluster_is_healthy() This is a holdover from when the previous test would restart daemons to get things ready for a test. There was also a bug where going into recovery during the restart would sometimes cause the cluster to become unhealthy. If we really need something like this then we can add it to ctdb_test_init(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add cluster.bash include fileMartin Schwenke2019-10-043-0/+20
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add function ctdb_test_skip_on_cluster()Martin Schwenke2019-10-046-21/+14
| | | | | | | Use it in relevant tests. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add function ctdb_test_on_cluster()Martin Schwenke2019-10-043-5/+10
| | | | | | | | This centralises this logic. Use it in a subset of tests - there are other cases but these will be cleaned up soon. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add functions for terminating tests on failure, skip, errorMartin Schwenke2019-10-041-0/+24
| | | | | | | | | | | | This allows standard exit codes for failed and skipped tests, and test errors. Skipped tests currently just succeed and a test error is the same as a failure. These can be easily changed later when run_tests.sh is ready to handle them. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Mark VacuumLimit tunable as obsoleteMartin Schwenke2019-10-045-22/+2
| | | | | | | | | | | Use of this tunable was dropped over 5 years ago in commit 16837bc309aa9a86fc21d7f59a8fce0b947428a3. 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 Oct 4 07:07:21 UTC 2019 on sn-devel-184
* ctdb-vacuum: Drop debug level of repacking message to NOTICEMartin Schwenke2019-10-041-2/+3
| | | | | | | | This occurs rarely but can adversely impact performance, so it is worth logging it more frequently. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Initialise request->rdata.opcode where missingMartin Schwenke2019-10-041-0/+4
| | | | | | | | | | | | | | | | | Otherwise it is uninitialised, so... ==22889== Conditional jump or move depends on uninitialised value(s) ==22889== at 0x12257B: ctdb_req_control_data_len (protocol_control.c:39) ==22889== by 0x1228E9: ctdb_req_control_len (protocol_control.c:1786) ==22889== by 0x12A51C: ctdb_client_control_send (client_control.c:101) ==22889== by 0x138BE1: ctdb_tunnel_setup_send (client_tunnel.c:100) ==22889== by 0x10EE4F: tunnel_test_send (tunnel_test.c:135) ==22889== by 0x10EE4F: main (tunnel_test.c:463) and similar. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-vacuum: Process all records not deleted on a remote nodeAmitay Isaacs2019-10-041-1/+1
| | | | | | | | | | This currently skips the last record. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14147 RN: Avoid potential data loss during recovery after vacuuming error Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Update READMEMartin Schwenke2019-09-261-72/+42
| | | | | | | | | | | Bring this up to date. Drop descriptions of command-line options because these tend to bit-rot - refer to "run_tests.sh -h" instead. 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): Thu Sep 26 06:01:33 UTC 2019 on sn-devel-184
* ctdb-tests: Move simple tests to INTEGRATION/ subdirectoryMartin Schwenke2019-09-2654-6/+6
| | | | | | | | Split some tests out into database/ and failover/ subdirectories. Rename the remaining tests in simple/. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move complex tests to CLUSTER/ subdirectoryMartin Schwenke2019-09-2620-5/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Convert local daemons include file into top-level includeMartin Schwenke2019-09-266-65/+78
| | | | | | | | | | | | | Do the same with the alternative code for real clusters. Both of these can now be used by other test suites. Fix some basic shellcheck warnings (e.g. avoid word-splitting by quoting) while moving code and add the new files to the shellcheck test. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop use of array in run_tests()Martin Schwenke2019-09-261-3/+1
| | | | | | | This doesn't accomplish anything. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop custom handling for unit testsMartin Schwenke2019-09-261-24/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Skip README files in test directories/collectionsMartin Schwenke2019-09-261-0/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Recurse into directories instead of explicitly loopingMartin Schwenke2019-09-261-10/+28
| | | | | | | | | | | | | | run_tests() already has a loop, so use it. This means collections of test suites can be handled - but explicitly check valid collection names to avoid running junk. Add special cases for simple and complex. These will be removed when those test suites are moved to collections. This seems to be the smallest amount of churn to support bisection. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fold find_and_run_one_test() in to run_tests()Martin Schwenke2019-09-261-41/+21
| | | | | | | The additional function makes the logic harder to understand. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move tool tests to UNIT/ subdirectoryMartin Schwenke2019-09-26135-3/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move takeover_helper tests to UNIT/ subdirectoryMartin Schwenke2019-09-2641-2/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move takeover tests to UNIT/ subdirectoryMartin Schwenke2019-09-2637-2/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move shellcheck tests to UNIT/ subdirectoryMartin Schwenke2019-09-2611-2/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move onnode tests to UNIT/ subdirectoryMartin Schwenke2019-09-2618-2/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move eventscript tests to UNIT/ subdirectoryMartin Schwenke2019-09-26256-2/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move eventd tests to UNIT/ subdirectoryMartin Schwenke2019-09-2649-2/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move cunit tests to UNIT/ subdirectoryMartin Schwenke2019-09-2641-2/+2
| | | | | | | | The UNIT subdirectory directory will contain all unit tests. Use an uppercase name to avoid conflicts with source code subdirectories. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch TEST_VAR_DIR to a local script variableMartin Schwenke2019-09-242-17/+15
| | | | | | | | | | This is now local to run_tests.sh. 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 Sep 24 03:46:59 UTC 2019 on sn-devel-184
* ctdb-tests: Use CTDB_TEST_TMP_DIR in integration.bashMartin Schwenke2019-09-241-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch simple tests to use CTDB_TEST_TMP_DIRMartin Schwenke2019-09-242-9/+1
| | | | | | | | | | CTDB_TEST_TMP_DIR repaces SIMPLE_TESTS_VAR_DIR. local.bash no longer needs to ensure that TEST_VAR_DIR is set, since it longer uses this variable. Drop the comment because state has not been maintained between tests for some time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch takeover helper unit tests to use CTDB_TEST_TMP_DIRMartin Schwenke2019-09-241-2/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch tool unit tests to use CTDB_TEST_TMP_DIRMartin Schwenke2019-09-241-3/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch onnode unit tests to use CTDB_TEST_TMP_DIRMartin Schwenke2019-09-242-12/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch eventscript unit tests to use CTDB_TEST_TMP_DIRMartin Schwenke2019-09-246-26/+19
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch eventd unit tests to use CTDB_TEST_TMP_DIRMartin Schwenke2019-09-241-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Switch cunit unit tests to use CTDB_TEST_TMP_DIRMartin Schwenke2019-09-2422-25/+25
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add new variable CTDB_TEST_TMP_DIRMartin Schwenke2019-09-241-0/+14
| | | | | | | | This is a subdirectory of TEST_VAR_DIR that is unique to the current test suite. It is recreated for each individual test. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move setting of CTDB_TEST_SUITE_DIR to run_tests.shMartin Schwenke2019-09-243-12/+10
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Rename variable TEST_SUBDIR -> CTDB_TEST_SUITE_DIRMartin Schwenke2019-09-247-20/+20
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use local_daemons.sh onnode for local daemons testsMartin Schwenke2019-09-241-5/+4
| | | | | | | | | | | | | With some upcoming changes, the setting of CTDB_BASE becomes problematic because it will be included unconditionally whereas it is currently being conveniently and almost accidentally not include in some contexts. So, instead of trying to coerce onnode into behaving as desired, have the local daemons tests use local_daemons.sh onnode directly. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>