summaryrefslogtreecommitdiff
path: root/ctdb/tests/scripts
AgeCommit message (Collapse)AuthorFilesLines
2024-03-06ctdb-scripts: Remove unnecessary 06.nfs.scriptVinit Agnihotri1-1/+0
Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com> Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2022-07-22ctdb-scripts: Avoid ShellCheck warning SC2295Martin Schwenke1-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>
2022-06-28ctdb-tool: Add UNKNOWN pseudo stateVinit Agnihotri1-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>
2022-04-06ctdb-tests: Add function test_case(), tweak unit test header formatMartin Schwenke1-1/+11
Instead of documenting test cases with a comment, this allows them to be documented via an argument to a function that is printed when the test case is run. This makes it easier locate test case failures when commands used by test cases look similar, Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-04-06ctdb-tests: Strip trailing newlines from expected result outputMartin Schwenke1-1/+6
This allows the provided output to be specified a little more carelessly. As per the comment, trailing newlines can't be matched anyway, so this is notionally a bug fix. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-04-06ctdb-tests: Reformat scriptMartin Schwenke1-126/+127
Samba is reformatting shell scripts using shfmt -w -p -i 0 -fn so update this one before editing. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-02-14ctdb-tests: Factor out functions to detect when generation changesMartin Schwenke1-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>
2022-01-17ctdb-tools: recovery master -> leaderMartin Schwenke1-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>
2022-01-17ctdb-tests: Factor out getting leader and waiting for leader changeMartin Schwenke1-0/+44
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
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>