mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-18 14:30:41 +01:00
Merge pull request #4088 from rgerhards/tb-robust
testbench: modernize some tests and make more robust
This commit is contained in:
commit
ad0390c34c
@ -2,6 +2,14 @@
|
|||||||
# added by Rainer Gerhards 2018-01-05
|
# added by Rainer Gerhards 2018-01-05
|
||||||
# part of the rsyslog project, released under ASL 2.0
|
# part of the rsyslog project, released under ASL 2.0
|
||||||
. ${srcdir:=.}/diag.sh init
|
. ${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
|
generate_conf
|
||||||
add_conf '
|
add_conf '
|
||||||
$ModLoad ../plugins/ommysql/.libs/ommysql
|
$ModLoad ../plugins/ommysql/.libs/ommysql
|
||||||
@ -17,17 +25,16 @@ if((not($msg contains "error")) and ($msg contains "msgnum:")) then {
|
|||||||
set $/cntr = 0;
|
set $/cntr = 0;
|
||||||
}
|
}
|
||||||
action(type="ommysql" name="mysql_action" server="127.0.0.1" template="tpl"
|
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
|
mysql_prep_for_test
|
||||||
startup
|
startup
|
||||||
injectmsg 0 50
|
injectmsg
|
||||||
wait_file_lines "$RSYSLOG2_OUT_LOG" 25
|
|
||||||
shutdown_when_empty
|
shutdown_when_empty
|
||||||
wait_shutdown
|
wait_shutdown
|
||||||
export EXPECTED="$(cat ${srcdir}/testsuites/action-tx-errfile.result)"
|
export EXPECTED="$(cat ${srcdir}/testsuites/action-tx-errfile.result)"
|
||||||
cmp_exact ${RSYSLOG2_OUT_LOG}
|
cmp_exact ${RSYSLOG2_OUT_LOG}
|
||||||
mysql_get_data
|
mysql_get_data
|
||||||
seq_check 0 49 -i2
|
seq_check
|
||||||
exit_test
|
exit_test
|
||||||
|
|||||||
@ -1,9 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# part of the rsyslog project, released under ASL 2.0
|
||||||
. ${srcdir:=.}/diag.sh init
|
. ${srcdir:=.}/diag.sh init
|
||||||
export NUMMESSAGES=5000
|
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
|
generate_conf
|
||||||
add_conf '
|
add_conf '
|
||||||
$ModLoad ../plugins/ommysql/.libs/ommysql
|
module(load="../plugins/ommysql/.libs/ommysql")
|
||||||
global(errormessagestostderr.maxnumber="50")
|
global(errormessagestostderr.maxnumber="50")
|
||||||
|
|
||||||
template(type="string" name="tpl" string="insert into SystemEvents (Message, Facility) values (\"%msg%\", %$!facility%)" option.sql="on")
|
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"
|
action(type="ommysql" name="mysql_action" server="127.0.0.1" template="tpl"
|
||||||
db="'$RSYSLOG_DYNNAME'" uid="rsyslog" pwd="testbench")
|
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
|
mysql_prep_for_test
|
||||||
startup
|
startup
|
||||||
@ -27,6 +34,5 @@ injectmsg
|
|||||||
shutdown_when_empty
|
shutdown_when_empty
|
||||||
wait_shutdown
|
wait_shutdown
|
||||||
mysql_get_data
|
mysql_get_data
|
||||||
export SEQ_CHECK_OPTIONS=-i2
|
|
||||||
seq_check
|
seq_check
|
||||||
exit_test
|
exit_test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user