6 Verify CTDB's debugging of timed out eventscripts
10 * An active CTDB cluster with monitoring enabled
14 * When an eventscript times out the correct debugging is executed.
18 .
"${TEST_SCRIPTS_DIR}/integration.bash"
24 ctdb_test_check_real_cluster
28 # No need for restart when done
30 # This is overkill but it at least provides a valid test node
31 select_test_node_and_ips
35 # Set this if CTDB is installed in a non-standard location on cluster
37 [ -n "$CTDB_BASE" ] || CTDB_BASE
="/etc/ctdb"
41 echo "Enable eventscript for testing timeouts..."
42 ctdb_test_exit_hook_add
"onnode -q $test_node $CTDB disablescript 99.timeout"
43 try_command_on_node
$test_node $CTDB enablescript
"99.timeout"
47 echo "Setting monitor events to time out..."
48 rc_local_d
="${CTDB_BASE}/rc.local.d"
49 try_command_on_node
$test_node mkdir
-p "$rc_local_d"
51 rc_local_f
="${rc_local_d}/timeout_config.$$"
52 ctdb_test_exit_hook_add
"onnode $test_node rm -f $rc_local_f"
54 try_command_on_node
$test_node mktemp
56 ctdb_test_exit_hook_add
"onnode $test_node rm -f $debug_output"
58 try_command_on_node
-i $test_node tee "$rc_local_f" <<<"\
59 CTDB_RUN_TIMEOUT_MONITOR=yes
60 CTDB_DEBUG_HUNG_SCRIPT_LOGFILE=\"$debug_output\"
61 CTDB_DEBUG_HUNG_SCRIPT_STACKPAT='exportfs|rpcinfo|sleep'"
63 try_command_on_node
$test_node chmod +x
"$rc_local_f"
67 wait_for_monitor_event
$test_node
69 echo "Waiting for debugging output to appear..."
70 # Use test -s because the file is created above using mktemp
71 wait_until
60 onnode
$test_node test -s "$debug_output"
73 echo "Checking output of hung script debugging..."
74 try_command_on_node
-v $test_node cat "$debug_output"
76 while IFS
="" read pattern
; do
77 if grep -- "^${pattern}\$" <<<"$out" >/dev
/null
; then
78 echo "GOOD: output contains \"$pattern\""
80 echo "BAD: output does not contain \"$pattern\""
84 ===== Start of hung script debug for PID=".*", event="monitor" =====
85 ===== End of hung script debug for PID=".*", event="monitor" =====
87 *\`-99\\.timeout,.* /etc/ctdb/events.d/99.timeout monitor
89 ---- Stack trace of interesting process [0-9]*\\[sleep\\] ----
90 [<[0-9a-f]*>] .*sleep+.*
91 ---- ctdb scriptstatus monitor: ----
92 [0-9]* scripts were executed last monitor cycle
93 99\\.timeout *Status:TIMEDOUT.*
94 *OUTPUT:sleeping for [0-9]* seconds\\.\\.\\.