diff options
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rwxr-xr-x | tests/rulesetmultiqueue.sh | 31 | ||||
-rw-r--r-- | tests/testsuites/rulesetmultiqueue.conf | 38 |
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 |