summaryrefslogtreecommitdiff
path: root/ctdb/tests/scripts
AgeCommit message (Collapse)AuthorFilesLines
2026-02-25ctdb-tests: Reorder and group script variables, add commentsMartin Schwenke1-9/+18
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-25ctdb-tests: Remove unused helper variable CTDB_SCRIPTS_HELPER_BINDIRMartin Schwenke1-3/+0
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-25ctdb-tools: Remove some helper variablesMartin Schwenke1-3/+0
Remove CTDB_EVENT_HELPER, CTDB_LVS_HELPER, CTDB_NATGW_HELPER. Use path_helperdir_append() instead. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-25ctdb-tests: Add CTDB_TEST_HELPER_BINDIRMartin Schwenke2-3/+10
Now that generated scripts are linked into bin/, nothing needs to be run from the tools/ directory anymore during self-test. So, introduce CTDB_TEST_HELPER_BINDIR to replace both CTDB_SCRIPTS_TOOLS_HELPER_DIR and CTDB_SCRIPTS_HELPER_BINDIR. Add this directory to PATH. CTDB_TEST_HELPER_BINDIR will also be used in combination with CTDB_TEST_MODE to allow helpers to be found via a single mechanism that uses this single variable. This will replace the multiple mechanisms and variables currently used. For simplicity, leave the old variables alone for now. Replacing them in a comprehensible way will take a few steps. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-25ctdb-tests: Add a useful commentMartin Schwenke1-0/+3
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-25ctdb-tests: Remove unused variablesMartin Schwenke1-4/+0
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-10-14ctdb-tests: Don't hard code creation of $CTDB_BASE/events/legacy/Martin Schwenke1-2/+0
setup_ctdb_base() should always create from etc-ctdb/. That directory may be changed to not include the legacy/ component subdirectory, so don't hard-code this particular subdirectory. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Tue Oct 14 17:57:49 UTC 2025 on atb-devel-224
2025-10-14ctdb-tests: Improve setup_ctdb_base() to fix local_daemons.sh bugMartin Schwenke1-0/+13
$ ctdb/tests/local_daemons.sh foo onnode 0 ctdb event script list legacy Unable to find event script installation directory: foo/node.0/share/events/legacy This happens if the $CTDB_BASE/share/events/legacy/ directory does not exist. This directory is (theoretically) for installed but not necessarily enabled event scripts. ctdb/tests/etc-ctdb/ contains events/legacy/ but setup_ctdb_base() currently does not ensure creation of the corresponding directory under $CTDB_BASE/share/. Ensure that an event script component installation subdirectory exists for each corresponding configuration subdirectory. An alternative would be to continue to allow the existing failure, but create directory ctdb/tests/etc-ctdb/share/events/legacy/ specifically to make local_daemons.sh work. However, it took 5 years to find the current bug, so this may be too subtle for other users of local_daemons.sh. Anyone wanting to test the failure case can remove unwanted subdirectories after "local_daemons.sh setup". Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-10-14ctdb-tests: Reformat with "shfmt -w -i 0 -fn "Martin Schwenke6-420/+436
Best reviewed with "git show -w". Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Ralph Boehme <slow@samba.org>
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>