summaryrefslogtreecommitdiffstats
path: root/tests/tcp_forwarding_retries.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/tcp_forwarding_retries.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/tcp_forwarding_retries.sh')
-rwxr-xr-xtests/tcp_forwarding_retries.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/tcp_forwarding_retries.sh b/tests/tcp_forwarding_retries.sh
new file mode 100755
index 0000000..eb7a69b
--- /dev/null
+++ b/tests/tcp_forwarding_retries.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+# added 2016-06-21 by RGerhards, released under ASL 2.0
+. ${srcdir:=.}/diag.sh init
+
+messages=20000 # how many messages to inject?
+# Note: we need to inject a somewhat larger number of messages in order
+# to ensure that we receive some messages in the actual output file,
+# as batching can (validly) cause a larger loss in the non-writable
+# file
+
+generate_conf
+add_conf '
+template(name="outfmt" type="string" string="%msg:F,58:2%\n")
+:msg, contains, "msgnum:" {
+ action(type="omfwd"
+ target="127.0.0.1" port="'$TCPFLOOD_PORT'" protocol="TCP"
+ action.resumeRetryCount="10"
+ template="outfmt")
+}
+'
+
+# we start a small receiver process
+./minitcpsrv -t127.0.0.1 -p$TCPFLOOD_PORT -f $RSYSLOG_OUT_LOG -s4 &
+BGPROCESS=$!
+echo background minitcpsrvr process id is $BGPROCESS
+
+startup
+injectmsg 0 $messages
+shutdown_when_empty
+wait_shutdown
+
+# note: minitcpsrvr shuts down automatically if the connection is closed, but
+# we still try to kill it in case the test did not connect to it! Note that we
+# do not need an extra wait, as the rsyslog shutdown process should have taken
+# far long enough.
+echo waiting on background process
+kill $BGPROCESS &> /dev/null
+wait $BGPROCESS
+
+seq_check 0 $(($messages-1))
+exit_test