rsyslog/tests/omjournal-basic-template.sh
Rainer Gerhards 1ed6859dfd
testbench: replace hardcoded ports and improve cleanup handling
Support tools (like tcpflood) are also upgraded to support the
necessary dynamic port.s

This is part of the effort to make parallel testing possible.

We move parts of the cleanup to the buildbot cleanup, as we cannot
clean out instances on each test when we run parallel tests.
2018-08-18 20:28:31 +02:00

33 lines
921 B
Bash
Executable File

#!/bin/bash
# a very basic test for omjournal.
# addd 2016-03-18 by RGerhards, released under ASL 2.0
. $srcdir/diag.sh init
. $srcdir/diag.sh require-journalctl
generate_conf
add_conf '
module(load="../plugins/imtcp/.libs/imtcp")
module(load="../plugins/omjournal/.libs/omjournal")
input(type="imtcp" port="'$TCPFLOOD_PORT'")
template(name="outfmt" type="string" string="%msg%")
action(type="omjournal" template="outfmt")
'
# we generate a cookie so that we can find our record in journal
COOKIE=`date`
echo "COOKIE: $COOKIE"
startup
tcpflood -m1 -M "\"<133>2011-03-01T11:22:12Z host tag msgh RsysLoG-TESTBENCH $COOKIE\""
./msleep 500
shutdown_when_empty
wait_shutdown
# if we reach this, we have at least not aborted
journalctl -r -t rsyslogd: |grep "RsysLoG-TESTBENCH $COOKIE"
if [ $? -ne 1 ]; then
echo "error: cookie $COOKIE not found. Head of journal:"
journalctrl -r -t rsyslogd: | head
exit 1
fi
exit_test