summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-30 08:48:55 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-30 08:48:55 +0100
commit7a51d07e941b82ea83b195d9e84c0fda46322f21 (patch)
tree49a7364f1ec817dcf356de8ad895572408737934 /tests
parent44057328a638ca03da0d6eda89fd19367178e6fc (diff)
downloadrsyslog-7a51d07e941b82ea83b195d9e84c0fda46322f21.tar.gz
rsyslog-7a51d07e941b82ea83b195d9e84c0fda46322f21.tar.xz
rsyslog-7a51d07e941b82ea83b195d9e84c0fda46322f21.zip
added test for ruleset-specific main queue
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rwxr-xr-xtests/rulesetmultiqueue.sh31
-rw-r--r--tests/testsuites/rulesetmultiqueue.conf38
3 files changed, 51 insertions, 21 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7e27b1ac..4e97e39f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,6 +10,7 @@ TESTS = $(TESTRUNS) cfg.sh \
daqueue-persist.sh \
diskqueue.sh \
diskqueue-fsync.sh \
+ rulesetmultiqueue.sh \
manytcp.sh \
queue-persist.sh
@@ -139,6 +140,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/master.rfctag \
testsuites/nolimittag.conf \
testsuites/master.nolimittag \
+ rulesetmultiqueue.sh \
+ testsuites/rulesetmultiqueue.conf \
badqi.sh \
testsuites/badqi.conf \
bad_qi/dbq.qi \
diff --git a/tests/rulesetmultiqueue.sh b/tests/rulesetmultiqueue.sh
index e91f0633..5f594adb 100755
--- a/tests/rulesetmultiqueue.sh
+++ b/tests/rulesetmultiqueue.sh
@@ -1,17 +1,26 @@
# Test for disk-only queue mode
-# This test checks if queue files can be correctly written
-# and read back, but it does not test the transition from
-# memory to disk mode for DA queues.
-# added 2009-04-17 by Rgerhards
+# This tests defines three rulesets, each one with its own queue. Then, it
+# sends data to them and checks the outcome. Note that we do need to
+# use some custom code as the test driver framework does not (yet?)
+# support multi-output-file operations.
+# added 2009-10-30 by Rgerhards
# This file is part of the rsyslog project, released under GPLv3
-# uncomment for debugging support:
-echo \[diskqueue.sh\]: testing queue disk-only mode
+echo \[rulesetmultiqueu.sh\]: testing multiple queues via rulesets
source $srcdir/diag.sh init
-source $srcdir/diag.sh startup diskqueue.conf
-# 20000 messages should be enough - the disk test is slow enough ;)
-sleep 4
-source $srcdir/diag.sh tcpflood 127.0.0.1 13514 1 20000
+rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log
+source $srcdir/diag.sh startup rulesetmultiqueue.conf
+source $srcdir/diag.sh wait-startup
+# now fill the three files (a bit sequentially, but they should
+# still get their share of concurrency - to increase the chance
+# we use three connections per set).
+source $srcdir/diag.sh tcpflood 127.0.0.1 13514 3 20000 0
+source $srcdir/diag.sh tcpflood 127.0.0.1 13515 3 20000 20000
+source $srcdir/diag.sh tcpflood 127.0.0.1 13516 3 20000 40000
source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
source $srcdir/diag.sh wait-shutdown
-source $srcdir/diag.sh seq-check 0 19999
+# now consolidate all logs into a single one so that we can use the
+# regular check logic
+cat rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log > rsyslog.out.log
+source $srcdir/diag.sh seq-check 0 59999
+rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log
source $srcdir/diag.sh exit
diff --git a/tests/testsuites/rulesetmultiqueue.conf b/tests/testsuites/rulesetmultiqueue.conf
index a992c5a5..c8a82dd6 100644
--- a/tests/testsuites/rulesetmultiqueue.conf
+++ b/tests/testsuites/rulesetmultiqueue.conf
@@ -1,16 +1,34 @@
-# Test for queue disk mode (see .sh file for details)
-# rgerhards, 2009-04-17
+# Test for multiple ruleset queues (see .sh file for details)
+# rgerhards, 2009-10-30
$IncludeConfig diag-common.conf
-
$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
+
+# general definition
+$template outfmt,"%msg:F,58:2%\n"
+
+# create the individual rulesets
+$ruleset file1
+$RulesetCreateMainQueue on
+$template dynfile1,"rsyslog.out1.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile1;outfmt
+
+$ruleset file2
+$RulesetCreateMainQueue on
+$template dynfile2,"rsyslog.out2.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile2;outfmt
+
+$ruleset file3
+$RulesetCreateMainQueue on
+$template dynfile3,"rsyslog.out3.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile3;outfmt
+
+# start listeners and bind them to rulesets
+$InputTCPServerBindRuleset file1
$InputTCPServerRun 13514
-# set spool locations and switch queue to disk-only mode
-$WorkDirectory test-spool
-$MainMsgQueueFilename mainq
-$MainMsgQueueType disk
+$InputTCPServerBindRuleset file2
+$InputTCPServerRun 13515
-$template outfmt,"%msg:F,58:2%\n"
-$template dynfile,"rsyslog.out.log" # trick to use relative path names!
-:msg, contains, "msgnum:" ?dynfile;outfmt
+$InputTCPServerBindRuleset file3
+$InputTCPServerRun 13516