From bb927bcbd59ed803555efbae9fff57f63ed11248 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Oct 04 2014 15:27:39 +0000 Subject: changes exim test to verify local mail delivery using the message ID --- diff --git a/tests/p_exim/20_exim_mta_helo-test.sh b/tests/p_exim/20_exim_mta_helo-test.sh index f0b373d..0e06dd3 100755 --- a/tests/p_exim/20_exim_mta_helo-test.sh +++ b/tests/p_exim/20_exim_mta_helo-test.sh @@ -4,30 +4,26 @@ t_Log "Running $0 - exim can accept and deliver local email." if [ $centos_ver == '5' ] - then - MAILSPOOL=/var/spool/exim/input/ - - # make shure spool dir is empty - rm -rf $MAILSPOOL* ret_val=1 # send mail to localhost - ./tests/p_exim/_helper_exim_helo.expect | grep -q "250 OK" - if [ $? = 0 ] + mail=$(echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep "250 OK") + MTA_ACCEPT=$? + if [ $MTA_ACCEPT == 0 ] then t_Log 'Mail has been queued successfully' - MTA_ACCEPT=0 fi - sleep 5 - grep -q 't_functional test' $MAILSPOOL* - if [ $? = 0 ] +250 OK id=1XaR7Q-0005D8-Cm + + regex='250\ OK\ id\=([0-9A-Za-z-]*)' + if [[ $mail =~ $regex ]] then - t_Log 'previously sent mail is in '$MAILSPOOL'*' - SPOOLFILE=0 + grep -q "${BASH_REMATCH[1]}: removed" /var/log/exim/main.log + DELIVERED=$? fi - if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) + if ([ $MTA_ACCEPT == 0 ] && [ $SPOOLFILE == 0 ]) then ret_val=0 fi diff --git a/tests/p_exim/30_exim_mta_ehlo-test.sh b/tests/p_exim/30_exim_mta_ehlo-test.sh index e740eb5..7fb9963 100755 --- a/tests/p_exim/30_exim_mta_ehlo-test.sh +++ b/tests/p_exim/30_exim_mta_ehlo-test.sh @@ -1,35 +1,29 @@ #!/bin/sh -# Author: Christoph Galuschka +# Author: Christoph Galuschka -t_Log "Running $0 - exim can accept and deliver local email using ESMTP/PIPELINING." +t_Log "Running $0 - exim can accept and deliver local email." if [ $centos_ver == '5' ] - then - SPOOLFILE=1 - MTA_ACCEPT=1 - MAILSPOOL=/var/spool/exim/input/ - - # make shure spool dir is empty - rm -rf $MAILSPOOL* ret_val=1 # send mail to localhost - ./tests/p_exim/_helper_exim_ehlo.expect | grep -q "250 OK" - if [ $? = 0 ] + mail=$(echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep "250 OK") + MTA_ACCEPT=$? + if [ $MTA_ACCEPT == 0 ] then t_Log 'Mail has been queued successfully' - MTA_ACCEPT=0 fi - sleep 5 - grep -q 't_functional test' $MAILSPOOL* - if [ $? = 0 ] +250 OK id=1XaR7Q-0005D8-Cm + + regex='250\ OK\ id\=([0-9A-Za-z-]*)' + if [[ $mail =~ $regex ]] then - t_Log 'previously sent mail is in '$MAILSPOOL'*' - SPOOLFILE=0 + grep -q "${BASH_REMATCH[1]}: removed" /var/log/exim/main.log + DELIVERED=$? fi - if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) + if ([ $MTA_ACCEPT == 0 ] && [ $SPOOLFILE == 0 ]) then ret_val=0 fi