summaryrefslogtreecommitdiffstats
path: root/tests/externalstate-failed-rcvr.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/externalstate-failed-rcvr.sh')
-rwxr-xr-xtests/externalstate-failed-rcvr.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/externalstate-failed-rcvr.sh b/tests/externalstate-failed-rcvr.sh
new file mode 100755
index 0000000..b3f23ca
--- /dev/null
+++ b/tests/externalstate-failed-rcvr.sh
@@ -0,0 +1,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