summaryrefslogtreecommitdiffstats
path: root/tests/execonlyonce.sh
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-12 13:36:29 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-12 13:36:29 +0100
commitadab485b93a6bc87a90337f9f46dac1a9dfd62b1 (patch)
tree7ff7c12a27f26a6d1e89330c2d31c783a5f8b6fc /tests/execonlyonce.sh
parent2dafb35077f013a22f0ce9d59306d8f59d709a51 (diff)
parent329b20451f0ed767dbf08903cab9a380ff1f4302 (diff)
downloadrsyslog-adab485b93a6bc87a90337f9f46dac1a9dfd62b1.tar.gz
rsyslog-adab485b93a6bc87a90337f9f46dac1a9dfd62b1.tar.xz
rsyslog-adab485b93a6bc87a90337f9f46dac1a9dfd62b1.zip
Merge branch 'v4-devel'
Conflicts: tests/Makefile.am
Diffstat (limited to 'tests/execonlyonce.sh')
-rwxr-xr-xtests/execonlyonce.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/execonlyonce.sh b/tests/execonlyonce.sh
new file mode 100755
index 00000000..a9b9d932
--- /dev/null
+++ b/tests/execonlyonce.sh
@@ -0,0 +1,28 @@
+# 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 GPLv3
+echo ===============================================================================
+echo \[execonlyonce.sh\]: test for the $ActionExecOnlyOnceEveryInterval directive
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup execonlyonce.conf
+source $srcdir/diag.sh tcpflood 127.0.0.1 13514 1 10 1
+# now wait until the interval definitely expires
+sleep 4 # one more than the once inerval!
+# and inject another couple of messages
+source $srcdir/diag.sh tcpflood 127.0.0.1 13514 1 10 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+
+# now we need your custom logic to see if the result is equal to the
+# expected result
+cmp rsyslog.out.log testsuites/execonlyonce.data
+if [ $? -eq 1 ]
+then
+ echo "ERROR, output not as expected"
+ exit 1
+fi
+source $srcdir/diag.sh exit