From 8be4e37df650c3d81a127f9f9fb20c1a0446c815 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 3 Jan 2020 11:45:55 +0100 Subject: [PATCH] testbench: modernize some tests and make more robust slow test machines are now better handled --- tests/action-tx-errfile.sh | 15 +++++++++++---- tests/action-tx-single-processing.sh | 12 +++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/action-tx-errfile.sh b/tests/action-tx-errfile.sh index cd452bbec..b72cb7865 100755 --- a/tests/action-tx-errfile.sh +++ b/tests/action-tx-errfile.sh @@ -2,6 +2,14 @@ # added by Rainer Gerhards 2018-01-05 # part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init +export NUMMESSAGES=50 # sufficient for our needs! +export SEQ_CHECK_OPTIONS=-i2 +check_sql_data_ready() { + mysql_get_data + seq_check --check-only +} +export QUEUE_EMPTY_CHECK_FUNC=check_sql_data_ready + generate_conf add_conf ' $ModLoad ../plugins/ommysql/.libs/ommysql @@ -17,17 +25,16 @@ if((not($msg contains "error")) and ($msg contains "msgnum:")) then { set $/cntr = 0; } action(type="ommysql" name="mysql_action" server="127.0.0.1" template="tpl" - db="'$RSYSLOG_DYNNAME'" uid="rsyslog" pwd="testbench" action.errorfile=`echo $RSYSLOG2_OUT_LOG`) + db="'$RSYSLOG_DYNNAME'" uid="rsyslog" pwd="testbench" action.errorfile="'$RSYSLOG2_OUT_LOG'") } ' mysql_prep_for_test startup -injectmsg 0 50 -wait_file_lines "$RSYSLOG2_OUT_LOG" 25 +injectmsg shutdown_when_empty wait_shutdown export EXPECTED="$(cat ${srcdir}/testsuites/action-tx-errfile.result)" cmp_exact ${RSYSLOG2_OUT_LOG} mysql_get_data -seq_check 0 49 -i2 +seq_check exit_test diff --git a/tests/action-tx-single-processing.sh b/tests/action-tx-single-processing.sh index 90b491061..e97175e68 100755 --- a/tests/action-tx-single-processing.sh +++ b/tests/action-tx-single-processing.sh @@ -1,9 +1,16 @@ #!/bin/bash +# part of the rsyslog project, released under ASL 2.0 . ${srcdir:=.}/diag.sh init export NUMMESSAGES=5000 +export SEQ_CHECK_OPTIONS=-i2 +check_sql_data_ready() { + mysql_get_data + seq_check --check-only +} +export QUEUE_EMPTY_CHECK_FUNC=check_sql_data_ready generate_conf add_conf ' -$ModLoad ../plugins/ommysql/.libs/ommysql +module(load="../plugins/ommysql/.libs/ommysql") global(errormessagestostderr.maxnumber="50") template(type="string" name="tpl" string="insert into SystemEvents (Message, Facility) values (\"%msg%\", %$!facility%)" option.sql="on") @@ -19,7 +26,7 @@ if($msg contains "msgnum:") then { action(type="ommysql" name="mysql_action" server="127.0.0.1" template="tpl" db="'$RSYSLOG_DYNNAME'" uid="rsyslog" pwd="testbench") } -action(type="omfile" file=`echo $RSYSLOG2_OUT_LOG`) +action(type="omfile" file="'$RSYSLOG2_OUT_LOG'") ' mysql_prep_for_test startup @@ -27,6 +34,5 @@ injectmsg shutdown_when_empty wait_shutdown mysql_get_data -export SEQ_CHECK_OPTIONS=-i2 seq_check exit_test