tests: New function get_ctdbd_command_line_option() for integration testing
authorMartin Schwenke <martin@meltin.net>
Mon, 14 May 2012 05:00:32 +0000 (15:00 +1000)
committerMartin Schwenke <martin@meltin.net>
Mon, 14 May 2012 05:13:41 +0000 (15:13 +1000)
This allows, for example, the public addresses file used by a
particular daemon to be known.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit f4b7d14f2e3c7345e7a09abb27c32923fb78cbc4)

ctdb/tests/scripts/integration.bash

index 7014910b6f3ac6a2d4dca38d42f5a405fa0c325a..652e4cacb88081f9ece02ce81a27417ecdc8973d 100644 (file)
@@ -739,6 +739,27 @@ ctdb_restart_when_done ()
     ctdb_test_restart_scheduled=true
 }
 
+get_ctdbd_command_line_option ()
+{
+    local pnn="$1"
+    local option="$2"
+
+    try_command_on_node "$pnn" "$CTDB getpid" || \
+       die "Unable to get PID of ctdbd on node $pnn"
+
+    local pid="${out#*:}"
+    try_command_on_node "$pnn" "ps -p $pid -o args hww" || \
+       die "Unable to get command-line of PID $pid"
+
+    # Strip everything up to and including --option
+    local t="${out#*--${option}}"
+    # Strip leading '=' or space if present
+    t="${t#=}"
+    t="${t# }"
+    # Strip any following options and print
+    echo "${t%% -*}"
+}
+
 #######################################
 
 install_eventscript ()