rsyslog/tests/glbl-oversizeMsg-truncate-imfile.sh
Rainer Gerhards a43a03f17e
testbench: make more test file names dynamic
This is required to support parallel test runs.

Among others, make thise files dynamic:
* test-spool
* rsyslog.input
* rsyslog.out*.log
* tmp.in

Also:
* convert presort test statement to function
* cleanup imfile truncation test
* cleanup imfile-growing-file-id test
  some cruft was left due to copy and paste error
* serialize mysql tests
2018-08-29 10:46:32 +02:00

48 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# add 2018-05-02 by PascalWithopf, released under ASL 2.0
. $srcdir/diag.sh init
. $srcdir/diag.sh check-inotify
./have_relpSrvSetOversizeMode
if [ $? -eq 1 ]; then
echo "imrelp parameter oversizeMode not available. Test stopped"
exit 77
fi;
generate_conf
add_conf '
module(load="../plugins/imfile/.libs/imfile")
global(maxMessageSize="230"
oversizemsg.input.mode="truncate")
input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input" tag="tag:")
template(name="outfmt" type="string" string="%rawmsg%\n")
action(type="omfile" template="outfmt"
file=`echo $RSYSLOG_OUT_LOG`)
'
echo '<167>Mar 1 01:00:00 172.20.245.8 tag msgnum:00000000:240:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' > $RSYSLOG_DYNNAME.input
startup
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown
# We need the ^-sign to symbolize the beginning and the $-sign to symbolize the end
# because otherwise we won't know if it was truncated at the right length.
grep "^<167>Mar 1 01:00:00 172.20.245.8 tag msgnum:00000000:240:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX$" $RSYSLOG_OUT_LOG #> /dev/null
if [ $? -ne 0 ]; then
echo
echo "FAIL: expected message not found. $RSYSLOG_OUT_LOG is:"
cat $RSYSLOG_OUT_LOG
error_exit 1
fi
grep "message too long.*begin of message is:" $RSYSLOG_OUT_LOG > /dev/null
if [ $? -ne 0 ]; then
echo
echo "FAIL: expected error message not found. $RSYSLOG_OUT_LOG is:"
cat $RSYSLOG_OUT_LOG
error_exit 1
fi
exit_test