From 384d96e8947dbd53b818cc1ec7be461ef6a82477 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Nov 17 2012 18:46:11 +0000 Subject: added test to really deliver email locally via postfix --- diff --git a/tests/p_postfix/10_postfix_smtp.sh b/tests/p_postfix/10_postfix_smtp.sh new file mode 100755 index 0000000..7489f6d --- /dev/null +++ b/tests/p_postfix/10_postfix_smtp.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Postfix SMTP test." + +echo "helo test" | nc -w 3 localhost 25 | grep -q '250' + +t_CheckExitStatus $? diff --git a/tests/p_postfix/20_postfix_mta.sh b/tests/p_postfix/20_postfix_mta.sh new file mode 100644 index 0000000..7c8a397 --- /dev/null +++ b/tests/p_postfix/20_postfix_mta.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - postfix can accept and deliver local email." + +MAILSPOOL=/var/spool/mail/root + +# make shure spool file is empty +cat /dev/null > $MAILSPOOL +ret_val=1 + +# send mail to localhost +echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc localhost 25 | grep -q "250 2.0.0" +if [ $? = 0 ] + then + t_Log 'Mail has been queued successfully' + MTA_ACCEPT=0 +fi + +sleep 1 +grep -q 't_functional test' $MAILSPOOL +if [ $? = 0 ] + then + t_Log 'previously sent mail is in '$MAILSPOOL + SPOOLFILE=0 +fi + +if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) + then + ret_val=0 +fi + +t_CheckExitStatus $ret_val +