diff --git a/tests/p_exim/20_exim_mta_helo-test.sh b/tests/p_exim/20_exim_mta_helo-test.sh index 6953271..5aa5b52 100755 --- a/tests/p_exim/20_exim_mta_helo-test.sh +++ b/tests/p_exim/20_exim_mta_helo-test.sh @@ -7,8 +7,11 @@ if [ $centos_ver == '5' ] then ret_val=1 + # create user for local delivery + useradd eximtest + # send mail to localhost - 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") + mail=$(./tests/p_exim/_helper_exim_helo.expect | grep "250 OK") MTA_ACCEPT=$? if [ $MTA_ACCEPT == 0 ] then @@ -18,11 +21,11 @@ if [ $centos_ver == '5' ] regex='250\ OK\ id\=([0-9A-Za-z-]*)' if [[ $mail =~ $regex ]] then - grep -q "${BASH_REMATCH[1]}: removed" /var/log/exim/main.log + grep -q "${BASH_REMATCH[1]} Completed" /var/log/exim/main.log DELIVERED=$? fi - if ([ $MTA_ACCEPT == 0 ] && [ $SPOOLFILE == 0 ]) + if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 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 7fb9963..a5fa272 100755 --- a/tests/p_exim/30_exim_mta_ehlo-test.sh +++ b/tests/p_exim/30_exim_mta_ehlo-test.sh @@ -4,31 +4,34 @@ t_Log "Running $0 - exim can accept and deliver local email." if [ $centos_ver == '5' ] + then ret_val=1 # send mail to localhost - 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") + mail=$(./tests/p_exim/_helper_exim_ehlo.expect | grep "250 OK") MTA_ACCEPT=$? if [ $MTA_ACCEPT == 0 ] then t_Log 'Mail has been queued successfully' fi -250 OK id=1XaR7Q-0005D8-Cm - regex='250\ OK\ id\=([0-9A-Za-z-]*)' if [[ $mail =~ $regex ]] then - grep -q "${BASH_REMATCH[1]}: removed" /var/log/exim/main.log + grep -q "${BASH_REMATCH[1]} Completed" /var/log/exim/main.log DELIVERED=$? fi - if ([ $MTA_ACCEPT == 0 ] && [ $SPOOLFILE == 0 ]) + if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) then ret_val=0 fi + + # delete user for local delivery + userdel eximtest + else - t_Log t_Log "This is not a C5 system - skipping" + t_Log "This is not a C5 system - skipping" ret_val=0 fi diff --git a/tests/p_exim/_helper_exim_ehlo.expect b/tests/p_exim/_helper_exim_ehlo.expect index b6ea2fc..d36e962 100755 --- a/tests/p_exim/_helper_exim_ehlo.expect +++ b/tests/p_exim/_helper_exim_ehlo.expect @@ -6,7 +6,7 @@ spawn telnet localhost 25 expect "220 *" send -- "ehlo localhost\n" expect -- "250-PIPELINING" -send -- "mail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\n" +send -- "mail from: root@localhost\nrcpt to: eximtest@localhost\ndata\nt_functional test\n.\n" expect -- "250\ OK" send -- "quit\n" expect "221*closing\ connection"