summaryrefslogtreecommitdiffstats
path: root/tests/omprog-feedback.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/omprog-feedback.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/omprog-feedback.sh')
-rwxr-xr-xtests/omprog-feedback.sh67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/omprog-feedback.sh b/tests/omprog-feedback.sh
new file mode 100755
index 0000000..464ce33
--- /dev/null
+++ b/tests/omprog-feedback.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# This file is part of the rsyslog project, released under ASL 2.0
+
+# This test tests the feedback feature of omprog (confirmMessages=on),
+# by checking that omprog re-sends to the external program the messages
+# it has failed to process.
+
+. ${srcdir:=.}/diag.sh init
+generate_conf
+add_conf '
+module(load="../plugins/omprog/.libs/omprog")
+
+template(name="outfmt" type="string" string="%msg%\n")
+
+:msg, contains, "msgnum:" {
+ action(
+ type="omprog"
+ binary="'$srcdir'/testsuites/omprog-feedback-bin.sh"
+ template="outfmt"
+ name="omprog_action"
+ queue.type="Direct" # the default; facilitates sync with the child process
+ confirmMessages="on"
+ reportFailures="on"
+ action.resumeInterval="1" # retry interval: 1 second
+# action.resumeRetryCount="0" # the default; no need to increase since
+ # the action resumes immediately
+ )
+}
+'
+startup
+injectmsg 0 10
+shutdown_when_empty
+wait_shutdown
+
+export EXPECTED="<= OK
+=> msgnum:00000000:
+<= OK
+=> msgnum:00000001:
+<= OK
+=> msgnum:00000002:
+<= OK
+=> msgnum:00000003:
+<= OK
+=> msgnum:00000004:
+<= Error: could not process log message
+=> msgnum:00000004:
+<= Error: could not process log message
+=> msgnum:00000004:
+<= OK
+=> msgnum:00000005:
+<= OK
+=> msgnum:00000006:
+<= OK
+=> msgnum:00000007:
+<= Error: could not process log message
+=> msgnum:00000007:
+<= Error: could not process log message
+=> msgnum:00000007:
+<= OK
+=> msgnum:00000008:
+<= OK
+=> msgnum:00000009:
+<= OK"
+
+cmp_exact $RSYSLOG_OUT_LOG
+
+exit_test