summaryrefslogtreecommitdiff
path: root/ctdb/tests/scripts/integration.bash
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-scripts: Avoid ShellCheck warning SC2295Martin Schwenke2022-07-221-1/+3
| | | | | | | | | | | | | | | | | | | For example: In /home/martins/samba/samba/ctdb/tools/onnode line 304: [ "$nodes" != "${nodes%[ ${nl}]*}" ] && verbose=true ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: [ "$nodes" != "${nodes%[ "${nl}"]*}" ] && verbose=true For more information: https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b... Who knew? Thanks ShellCheck! Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tool: Add UNKNOWN pseudo stateVinit Agnihotri2022-06-281-8/+8
| | | | | | | | | | | | | When a node is starting, CTDB reports remote nodes as unhealthy by default. This can be misleading. To hide this, report an "UNKNOWN" pseudo state when a remote node is not disconnected and the runstate is less than or equal to "FIRST_RECOVERY". Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Factor out functions to detect when generation changesMartin Schwenke2022-02-141-0/+44
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14958 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: recovery master -> leaderMartin Schwenke2022-01-171-1/+1
| | | | | | | | | | | | | | | | The following command names are changed: recmaster -> leader setrecmasterrole -> setleaderrole Command output changed for the following commands: status getcapabilities Documentation and tests are updated to reflect these changes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Factor out getting leader and waiting for leader changeMartin Schwenke2022-01-171-0/+44
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Don't bother shutting down daemons in ctdb_init()Martin Schwenke2020-07-221-2/+0
| | | | | | They'll never be up here... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Separate custom cluster startup from test initialisationMartin Schwenke2020-07-221-3/+21
| | | | | | | | | | | | | | | | | | | Separate cluster startup from test initialisation for tests that start the cluster with customised configuration. In these cases the result of the cluster startup is actually the point of the test. Additionally, pubips.013.failover_noop.sh claims to have completed test initialisation twice, which just seems wrong. The result is: * ctdb_test_init() takes one option (-n) to indicate when it should not configure/start the cluster * New function ctdb_nodes_start_custom() accepts options for special cluster configuration, only operates on local daemons and triggers a test failure rather than a test error on failure. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()Martin Schwenke2020-07-221-6/+15
| | | | | | | | The only caller calls ctdb_test_error() on failure and nesting this calls can be confusing. A future change will make this even more confusing. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make integration.bash pass shellcheckMartin Schwenke2020-07-221-41/+51
| | | | | | | | | | | | | | | | Apart from the non-constant sourcing of include files. Mostly avoidance of quoting warnings. One subtle change is to simply pass "120" to wait_until_ready() to stop warnings that it expects arguments but none are passed (both SC2119 and SC2120). There seems no way to indicate to structure function argument handling so that shellcheck realises arguments are optional. In later shellcheck versions, disabling SC2120 for a function also silences complaints about its callers... but not all of our testing uses "later" shellcheck versions. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Stop cat command failure from causing test failureMartin Schwenke2020-07-221-1/+1
| | | | | | | | | | | | In certain circumstance, which aren't obvious, cat(1) can fail when attempting to write a lot of data. This is due to something (probably write(2)) returning EAGAIN. Given that the -v option should only really be used for test debugging, ignore the failure instead of spending time debugging it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14446 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Revert "ctdb-tests: Make integration.bash pass shellcheck"Martin Schwenke2020-07-221-51/+41
| | | | | | | | | Fix missing Reviewed-by: tag. This reverts commit 0f04b8a70be3b8e157a4a88e9e54e87fa380022e. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Revert "ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()"Martin Schwenke2020-07-221-15/+6
| | | | | | | | | Fix missing Reviewed-by: tag. This reverts commit 44e05ac8515be3220a334ae8001db83b06bec59f. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Revert "ctdb-tests: Separate custom cluster startup from test initialisation"Martin Schwenke2020-07-221-21/+3
| | | | | | | | | Fix missing Reviewed-by: tag. This reverts commit e9df17b500146e62539feac66d0cd4b3ef7aa47a. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Revert "ctdb-tests: Don't bother shutting down daemons in ctdb_init()"Martin Schwenke2020-07-221-0/+2
| | | | | | | | | Fix missing Reviewed-by: tag. This reverts commit 58f9f699f181ac217cda8de512b8385da173f884. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Revert "ctdb-tests: Stop cat command failure from causing test failure"Martin Schwenke2020-07-221-1/+1
| | | | | | | | | Fix missing Reviewed-by: tag. This reverts commit 5707781ccf682d95a5a05a7c3e00a43003dbe62e. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Stop cat command failure from causing test failureMartin Schwenke2020-07-221-1/+1
| | | | | | | | | | | | | | | In certain circumstance, which aren't obvious, cat(1) can fail when attempting to write a lot of data. This is due to something (probably write(2)) returning EAGAIN. Given that the -v option should only really be used for test debugging, ignore the failure instead of spending time debugging it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14446 Signed-off-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Jul 22 04:10:47 UTC 2020 on sn-devel-184
* ctdb-tests: Don't bother shutting down daemons in ctdb_init()Martin Schwenke2020-07-221-2/+0
| | | | | | They'll never be up here... Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Separate custom cluster startup from test initialisationMartin Schwenke2020-07-221-3/+21
| | | | | | | | | | | | | | | | | | | Separate cluster startup from test initialisation for tests that start the cluster with customised configuration. In these cases the result of the cluster startup is actually the point of the test. Additionally, pubips.013.failover_noop.sh claims to have completed test initialisation twice, which just seems wrong. The result is: * ctdb_test_init() takes one option (-n) to indicate when it should not configure/start the cluster * New function ctdb_nodes_start_custom() accepts options for special cluster configuration, only operates on local daemons and triggers a test failure rather than a test error on failure. Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()Martin Schwenke2020-07-221-6/+15
| | | | | | | | The only caller calls ctdb_test_error() on failure and nesting this calls can be confusing. A future change will make this even more confusing. Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Make integration.bash pass shellcheckMartin Schwenke2020-07-221-41/+51
| | | | | | | | | | | | | | | | Apart from the non-constant sourcing of include files. Mostly avoidance of quoting warnings. One subtle change is to simply pass "120" to wait_until_ready() to stop warnings that it expects arguments but none are passed (both SC2119 and SC2120). There seems no way to indicate to structure function argument handling so that shellcheck realises arguments are optional. In later shellcheck versions, disabling SC2120 for a function also silences complaints about its callers... but not all of our testing uses "later" shellcheck versions. Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Flag setup, startup, shutdown failures as test errorsMartin Schwenke2020-02-181-3/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Rationalise node stop/start/restartMartin Schwenke2020-02-181-4/+11
| | | | | | | | | | | | | Separate functions are not needed for stopping/starting/restarting individual nodes. The stop and start functions essentially just use onnode, though for local daemons this is embedded in local_daemons.sh. So, just provide one stop and one start function that takes an optional nodespec, defaulting to all nodes. Restarting becomes common. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Improve code quality in ctdb_init()Martin Schwenke2019-11-061-7/+9
| | | | | | | | Improve quoting and indentation. Print a clear error if the cluster goes back into recovery and doesn't come back out. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: No longer retry starting the clusterMartin Schwenke2019-11-061-30/+4
| | | | | | | | Retrying like this hides bugs. The cluster should come up first time, every time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add handling of process clean-up on a cluster nodeMartin Schwenke2019-10-241-0/+28
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Prefix remaining environment variables with CTDB_Martin Schwenke2019-10-221-1/+1
| | | | | | | | | | | Now they are clearly all part of CTDB. TEST_SOCKET_WRAPPER_SO_PATH gets too long in integration_local_daemons.bash, so change it to CTDB_TEST_SWRAP_SO_PATH instead of just prefixing. 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: Add function ctdb_test_skip_on_cluster()Martin Schwenke2019-10-041-0/+8
| | | | | | | 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-041-2/+7
| | | | | | | | 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: Convert local daemons include file into top-level includeMartin Schwenke2019-09-261-61/+7
| | | | | | | | | | | | | 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: 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: Rename variable TEST_SUBDIR -> CTDB_TEST_SUITE_DIRMartin Schwenke2019-09-241-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Move NFS test functions to complex local scriptMartin Schwenke2019-09-171-32/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Don't retrieve the VNN map from target node for notlmasterMartin Schwenke2019-08-211-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>
* ctdb-tests: Handle special cases first and returnMartin Schwenke2019-08-211-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>
* ctdb-tests: Inline handling of recovered and notlmaster statusesMartin Schwenke2019-08-211-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>
* ctdb-tests: Drop unused node statuses frozen/unfrozenMartin Schwenke2019-08-211-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>
* ctdb-tests: Reformat node_has_status()Martin Schwenke2019-08-211-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>
* 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: 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: 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: Avoid bulk output in $out, prefer $outfileMartin Schwenke2019-05-071-31/+9
| | | | | | | 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-071-3/+2
| | | | | | | | | | | 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-tests: Change all cluster setup to use ctdb_test_init()Martin Schwenke2018-11-061-1/+1
| | | | | | | | | | | 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 ctdb_restart_when_done()Martin Schwenke2018-11-061-7/+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: Move enabling of event scripts to setup_ctdb()Martin Schwenke2018-11-061-2/+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: 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>