mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-13 07:10:42 +01:00
Some old tests are carried out via the nettester tool. This was our initial shot at a testbench a couple of years ago. While it worked back then, the testbench framework has been much enhanced. These old tests are nowadays very hard to handle, as they miss debug support etc. So it is time to refactor them to new style. As a side-activity, the testbench plumbing has been enhanced to support some operations commonly needed by these tests. Contrary to pre-existing plumbing, these new operations are now crafted using bash functions, which we consider superior to the current method. So this is also the start of converting the older-style functionality into bash functions. We just did this now because it was required and we entangled it into the test refactoring because it was really needed. Else we had to write old-style operations and convert them in another commit, which would have been a waste of time. Special thanks to Pascal Withopf for the initial step of taking old tests and putting config as well as test data together into the refactored tests, on which Rainer Gerhards than could build to create the new tests and update testbench plumbing.
33 lines
1.2 KiB
Bash
Executable File
33 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# add 2018-06-27 by Pascal Withopf, released under ASL 2.0
|
|
. $srcdir/diag.sh init
|
|
. $srcdir/diag.sh generate-conf
|
|
. $srcdir/diag.sh add-conf '
|
|
module(load="../plugins/imudp/.libs/imudp")
|
|
input(type="imudp" port="13514" ruleset="ruleset1")
|
|
|
|
|
|
template(name="outfmt" type="string" string="%timereported:1:19:date-rfc3339,csv%, %hostname:::csv%, %programname:::csv%, %syslogtag:R,ERE,0,BLANK:[0-9]+--end:csv%, %syslogseverity:::csv%, %msg:::drop-last-lf,csv%\n")
|
|
|
|
ruleset(name="ruleset1") {
|
|
action(type="omfile" file="rsyslog.out.log"
|
|
template="outfmt")
|
|
}
|
|
|
|
'
|
|
. $srcdir/diag.sh startup
|
|
. $srcdir/diag.sh tcpflood -m1 -T "udp" -M "\"<175>Oct 16 2009 23:47:31 hostname tag This is a message\""
|
|
. $srcdir/diag.sh tcpflood -m1 -T "udp" -M "\"<175>Oct 16 2009 23:47:31 hostname tag[1234] This is a message\""
|
|
. $srcdir/diag.sh shutdown-when-empty
|
|
. $srcdir/diag.sh wait-shutdown
|
|
|
|
echo '"2009-10-16T23:47:31", "hostname", "tag", "", "7", " This is a message"
|
|
"2009-10-16T23:47:31", "hostname", "tag", "1234", "7", " This is a message"' | cmp - rsyslog.out.log
|
|
if [ ! $? -eq 0 ]; then
|
|
echo "invalid response generated, rsyslog.out.log is:"
|
|
cat rsyslog.out.log
|
|
. $srcdir/diag.sh error-exit 1
|
|
fi;
|
|
|
|
. $srcdir/diag.sh exit
|