rsyslog/tests/imptcp_conndrop-vg.sh
Rainer Gerhards 6cb60302c5
testbench: improve robustness against slow CI, gen. improvements
* add an overall timeout value for tests - if running longer,
  testbench framework tries to FAIL and end test. Note that
  this is not bullet-proof and not intended to be so.
* guard against hanging rsyslog instances via a new imdiag
  feature to abort after n number of seconds; among others,
  this guards as against timeout-cancel in CI, which is always
  pretty hard to diagnose - now we see these errors in test-suite.log
* fix a bug in tcp zip test, which actually did not use zip mode
* experimnentalls add debug output to better understand
  shutdown_when_empty operation; goal is to improve understanding
  and then remove that code again.
* improve shutdown predicate for a couple of tests
* made travis run make check with two parallel threads, for which
  we seem ready now. Nevertheless, it's still experimental and we
  may roll this back if required.
2018-12-28 13:03:57 +01:00

32 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# test imptcp with random connection drops
# This file is part of the rsyslog project, released under ASL 2.0
# Copyright (C) 2014 Rainer Gerhards -- 2014-11-14
. ${srcdir:=.}/diag.sh init
export NUMMESSAGES=10000 # even if it is slow, we use a large number to be
# sure to have sufficient connection drops
generate_conf
add_conf '
$MaxMessageSize 10k
$ModLoad ../plugins/imptcp/.libs/imptcp
$MainMsgQueueTimeoutShutdown 10000
$InputPTCPServerRun '$TCPFLOOD_PORT'
$template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n"
template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names!
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
local0.* ?dynfile;outfmt
'
startup_vg
# 100 byte messages to gain more practical data use
tcpflood -c20 -m$NUMMESSAGES -r -d100 -P129 -D
sleep 10 # due to large messages, we need this time for the tcp receiver to settle...
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown_vg # and wait for it to terminate
check_exit_vg
seq_check 0 $(( NUMMESSAGES - 1 )) -E
exit_test