summaryrefslogtreecommitdiff
path: root/ctdb/tests/scripts/integration.bash
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2022-01-23 06:42:52 +1100
committerAmitay Isaacs <amitay@samba.org>2022-02-14 01:47:31 +0000
commit265e44abc42e1f5b7fef6550cd748459dbef80cb (patch)
treec4bb0ad1b834d49eb169c7d67028d221ccc97a47 /ctdb/tests/scripts/integration.bash
parent0e74e03c9cf83d5dc2d97fa9f38ff8fbaa3d2685 (diff)
downloadsamba-265e44abc42e1f5b7fef6550cd748459dbef80cb.tar.gz
ctdb-tests: Factor out functions to detect when generation changes
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>
Diffstat (limited to 'ctdb/tests/scripts/integration.bash')
-rw-r--r--ctdb/tests/scripts/integration.bash44
1 files changed, 44 insertions, 0 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 25ee4d945cc..eb3db1e1849 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -688,6 +688,50 @@ wait_until_leader_has_changed ()
#######################################
+# sets: generation
+_generation_get ()
+{
+ local node="$1"
+
+ ctdb_onnode "$node" status
+ # shellcheck disable=SC2154
+ # $outfile set by ctdb_onnode() above
+ generation=$(sed -n -e 's/^Generation:\([0-9]*\)/\1/p' "$outfile")
+}
+
+generation_get ()
+{
+ local node="$1"
+
+ echo "Get generation"
+ _generation_get "$node"
+ echo "Generation is ${generation}"
+ echo
+}
+
+_generation_has_changed ()
+{
+ local node="$1"
+ local generation_old="$2"
+
+ _generation_get "$node"
+
+ [ "$generation" != "$generation_old" ]
+}
+
+# uses: generation
+wait_until_generation_has_changed ()
+{
+ local node="$1"
+
+ echo "Wait until generation changes..."
+ wait_until 30 _generation_has_changed "$node" "$generation"
+ echo "Generation changed to ${generation}"
+ echo
+}
+
+#######################################
+
wait_for_monitor_event ()
{
local pnn="$1"