summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-09-29 08:27:33 +1000
committerAmitay Isaacs <amitay@samba.org>2019-10-24 04:06:44 +0000
commit49262a6bc4d5f8b81aa341294bfe04a22a6b32b6 (patch)
treee8582cb3cd981921adc58ba1767b88a8234ee99c /ctdb
parentb9654085f5facfe8a3d64667d65793146563d7f5 (diff)
downloadsamba-49262a6bc4d5f8b81aa341294bfe04a22a6b32b6.tar.gz
ctdb-tests: Add handling of process clean-up on a cluster node
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tests/scripts/integration.bash28
1 files changed, 28 insertions, 0 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index bbb3a64ea5a..d5bd542ab00 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -60,6 +60,34 @@ ctdb_test_exit_hook_add ()
ctdb_test_exit_hook="${ctdb_test_exit_hook}${ctdb_test_exit_hook:+ ; }$*"
}
+# Setting cleanup_pid to <pid>@<node> will cause <pid> to be killed on
+# <node> when the test completes. To cancel, just unset cleanup_pid.
+ctdb_test_cleanup_pid=""
+ctdb_test_cleanup_pid_exit_hook ()
+{
+ if [ -n "$ctdb_test_cleanup_pid" ] ; then
+ local pid="${ctdb_test_cleanup_pid%@*}"
+ local node="${ctdb_test_cleanup_pid#*@}"
+
+ try_command_on_node "$node" "kill ${pid}"
+ fi
+}
+
+ctdb_test_exit_hook_add ctdb_test_cleanup_pid_exit_hook
+
+ctdb_test_cleanup_pid_set ()
+{
+ local node="$1"
+ local pid="$2"
+
+ ctdb_test_cleanup_pid="${pid}@${node}"
+}
+
+ctdb_test_cleanup_pid_clear ()
+{
+ ctdb_test_cleanup_pid=""
+}
+
ctdb_test_init ()
{
trap "ctdb_test_exit" 0