diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
commit | dcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch) | |
tree | 66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/execonlyonce.sh | |
parent | Initial commit. (diff) | |
download | rsyslog-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/execonlyonce.sh')
-rwxr-xr-x | tests/execonlyonce.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/execonlyonce.sh b/tests/execonlyonce.sh new file mode 100755 index 0000000..5ab9739 --- /dev/null +++ b/tests/execonlyonce.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Test for the $ActionExecOnlyOnceEveryInterval directive. +# We inject a couple of messages quickly during the interval, +# then wait until the interval expires, then quickly inject +# another set. After that, it is checked if exactly two messages +# have arrived. +# The once interval must be set to 3 seconds in the config file. +# added 2009-11-12 by Rgerhards +# This file is part of the rsyslog project, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") + +$template outfmt,"%msg:F,58:2%\n" +template(name="dynfile" type="string" string="'$RSYSLOG_OUT_LOG'") +$ActionExecOnlyOnceEveryInterval 3 +:msg, contains, "msgnum:" ?dynfile;outfmt +' +startup +tcpflood -m10 -i1 +# now wait until the interval definitely expires (at least we hope so...) +printf 'wainting for interval to expire...\n' +sleep 5 +# and inject another couple of messages +tcpflood -m10 -i100 +shutdown_when_empty +wait_shutdown + +export EXPECTED="00000001 +00000100" +cmp_exact +exit_test |