summaryrefslogtreecommitdiff
path: root/ctdb/tests/scripts
AgeCommit message (Collapse)AuthorFilesLines
2020-07-22ctdb-tests: Don't bother shutting down daemons in ctdb_init()Martin Schwenke1-2/+0
They'll never be up here... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-07-22ctdb-tests: Separate custom cluster startup from test initialisationMartin Schwenke1-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>
2020-07-22ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()Martin Schwenke1-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>
2020-07-22ctdb-tests: Make unit.sh pass shellcheckMartin Schwenke1-5/+10
Mostly avoidance of quoting warnings. Silencing warnings about unquoted $CTDB_TEST_CAT_RESULTS_OPTS is handled by passing '-' to cat when that variable's value is empty. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-07-22ctdb-tests: Make integration.bash pass shellcheckMartin Schwenke1-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>
2020-07-22ctdb-tests: Use "#!/usr/bin/env bash" for improved portabilityMartin Schwenke1-1/+1
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-07-22ctdb-tests: Stop cat command failure from causing test failureMartin Schwenke1-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>
2020-07-22Revert "ctdb-tests: Use "#!/usr/bin/env bash" for improved portability"Martin Schwenke1-1/+1
Fix missing Reviewed-by: tag. This reverts commit 9a7cabd342d0aed450ed3305931702a7351f814a. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-07-22Revert "ctdb-tests: Make integration.bash pass shellcheck"Martin Schwenke1-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>
2020-07-22Revert "ctdb-tests: Make unit.sh pass shellcheck"Martin Schwenke1-10/+5
Fix missing Reviewed-by: tag. This reverts commit 30293baae5f22628405d327fc0b6bae993e96cd8. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-07-22Revert "ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()"Martin Schwenke1-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>
2020-07-22Revert "ctdb-tests: Separate custom cluster startup from test initialisation"Martin Schwenke1-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>
2020-07-22Revert "ctdb-tests: Don't bother shutting down daemons in ctdb_init()"Martin Schwenke1-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>
2020-07-22Revert "ctdb-tests: Stop cat command failure from causing test failure"Martin Schwenke1-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>
2020-07-22ctdb-tests: Stop cat command failure from causing test failureMartin Schwenke1-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
2020-07-22ctdb-tests: Don't bother shutting down daemons in ctdb_init()Martin Schwenke1-2/+0
They'll never be up here... Signed-off-by: Martin Schwenke <martin@meltin.net>
2020-07-22ctdb-tests: Separate custom cluster startup from test initialisationMartin Schwenke1-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>
2020-07-22ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()Martin Schwenke1-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>
2020-07-22ctdb-tests: Make unit.sh pass shellcheckMartin Schwenke1-5/+10
Mostly avoidance of quoting warnings. Silencing warnings about unquoted $CTDB_TEST_CAT_RESULTS_OPTS is handled by passing '-' to cat when that variable's value is empty. Signed-off-by: Martin Schwenke <martin@meltin.net>
2020-07-22ctdb-tests: Make integration.bash pass shellcheckMartin Schwenke1-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>
2020-07-22ctdb-tests: Use "#!/usr/bin/env bash" for improved portabilityMartin Schwenke1-1/+1
Signed-off-by: Martin Schwenke <martin@meltin.net>
2020-03-10ctdb-tests: Add function ctdb_test_check_supported_OSMartin Schwenke1-0/+13
Skips test if not on one of the supported OSes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-02-18ctdb-tests: Flag setup, startup, shutdown failures as test errorsMartin Schwenke1-3/+3
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-02-18ctdb-tests: Dump logs on shutdown failureMartin Schwenke1-4/+21
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-02-18ctdb-tests: Rationalise node stop/start/restartMartin Schwenke3-43/+23
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>
2020-02-12ctdb-tests: Fix handling of --no-event-scripts optionMartin Schwenke1-4/+4
Shellcheck noticed that pnn was never referenced. Not sure this ever worked or whether it got broken somewhere along the way. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-02-12ctdb-tests: Increase to dumping up to 500 lines of logs on errorMartin Schwenke1-1/+1
100 lines are not enough to debug a current issue. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-02-10ctdb-tests: Use $PWD/bin/ if it exists when running in-treeMartin Schwenke1-6/+27
When running tests from a top-level build, a stale build in ctdb/bin/ will be preferred and may cause confusing results. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-02-10ctdb-tests: Make $ctdb_dir absoluteMartin Schwenke1-2/+2
This is used to set several variables so it might as well be cd-proof. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-11-06ctdb-tests: Improve code quality in ctdb_init()Martin Schwenke1-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>
2019-11-06ctdb-tests: No longer retry starting the clusterMartin Schwenke1-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>
2019-10-24ctdb-tests: Add handling of process clean-up on a cluster nodeMartin Schwenke1-0/+28
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-22ctdb-tests: Prefix remaining environment variables with CTDB_Martin Schwenke3-11/+11
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>
2019-10-22ctdb-tests: Add run_tests.sh option to print logs on test failureMartin Schwenke1-0/+17
Implement this for local daemons integration tests, dumping last 100 lines of logs. This makes it possible to debug some failures in automated tests where the logs are unavailable for analysis. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04ctdb-tests: Add handling for skipped testsMartin Schwenke1-1/+1
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04ctdb-tests: Add a special failure code when a test error occursMartin Schwenke1-1/+1
Use it when a test is not executable. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04ctdb-tests: Add new test functions for running commands on nodesMartin Schwenke1-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>
2019-10-04ctdb-tests: try_command_on_node() should return status of commandMartin Schwenke1-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>
2019-10-04ctdb-tests: Add cluster.bash include fileMartin Schwenke1-0/+18
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04ctdb-tests: Add function ctdb_test_skip_on_cluster()Martin Schwenke1-0/+8
Use it in relevant tests. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04ctdb-tests: Add function ctdb_test_on_cluster()Martin Schwenke1-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>
2019-10-04ctdb-tests: Add functions for terminating tests on failure, skip, errorMartin Schwenke1-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>
2019-09-26ctdb-tests: Convert local daemons include file into top-level includeMartin Schwenke3-61/+148
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>
2019-09-24ctdb-tests: Use CTDB_TEST_TMP_DIR in integration.bashMartin Schwenke1-1/+1
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24ctdb-tests: Move setting of CTDB_TEST_SUITE_DIR to run_tests.shMartin Schwenke1-6/+0
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24ctdb-tests: Rename variable TEST_SUBDIR -> CTDB_TEST_SUITE_DIRMartin Schwenke3-7/+7
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17ctdb-tests: Move NFS test functions to complex local scriptMartin Schwenke1-32/+0
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21ctdb-tests: Don't retrieve the VNN map from target node for notlmasterMartin Schwenke1-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>
2019-08-21ctdb-tests: Handle special cases first and returnMartin Schwenke1-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>
2019-08-21ctdb-tests: Inline handling of recovered and notlmaster statusesMartin Schwenke1-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>