summaryrefslogtreecommitdiffstats
path: root/tests/externalstate-failed-rcvr.sh
blob: b3f23cafce3c2edb2c069d4410cfff904f429ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# This tests the action suspension via a file and ensure that it does
# NOT override actual target suspension state.
# This file is part of the rsyslog project, released under ASL 2.0
# Written 2019-01-08 by Rainer Gerhards
. ${srcdir:=.}/diag.sh init
export NUMMESSAGES=2500
export QUEUE_EMPTY_CHECK_FUNC=wait_seq_check

# IMPORTANT: nothing permitted to listen on $TCPFLOOD_PORT!
# mimic some good state in external statefile:
printf "%s" "READY" > $RSYSLOG_DYNNAME.STATE

generate_conf
add_conf '
$template outfmt,"%msg:F,58:2%\n"

:msg, contains, "msgnum:" {
	action(name="primary" type="omfwd" target="localhost" port="'$TCPFLOOD_PORT'"
		protocol="tcp" action.externalstate.file="'$RSYSLOG_DYNNAME'.STATE")
	action(name="failover" type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt"
		action.execOnlyWhenPreviousIsSuspended="on")
}
'
startup
injectmsg
shutdown_when_empty
wait_shutdown
# note: we do NOT need to do a check_seq as this was already done as part of the
# queue empty predicate check
exit_test