bstinson / centos / t_functional

Forked from centos/t_functional 3 years ago
Clone

Blame tests/p_exim/30_exim_mta_ehlo-test.sh

e0746c
#!/bin/bash
bb927b
# Author: Christoph Galuschka <tigalch@tigalch.org>
Christoph Galuschka d05160
bb927b
t_Log "Running $0 - exim can accept and deliver local email."
Christoph Galuschka d05160
Christoph Galuschka d05160
if [ $centos_ver == '5' ]
a02188
  then
Christoph Galuschka d05160
  ret_val=1
Christoph Galuschka d05160
Christoph Galuschka d05160
  # send mail to localhost
a02188
  mail=$(./tests/p_exim/_helper_exim_ehlo.expect | grep "250 OK")
bb927b
  MTA_ACCEPT=$?
bb927b
  if [ $MTA_ACCEPT == 0 ]
Christoph Galuschka d05160
    then
Christoph Galuschka d05160
    t_Log 'Mail has been queued successfully'
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
bb927b
  regex='250\ OK\ id\=([0-9A-Za-z-]*)'
bb927b
  if [[ $mail =~ $regex ]]
Christoph Galuschka d05160
    then
5a9020
    sleep 1
a02188
    grep -q "${BASH_REMATCH[1]} Completed" /var/log/exim/main.log
bb927b
    DELIVERED=$?
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
a02188
  if ([ $MTA_ACCEPT == 0  ] && [ $DELIVERED == 0 ])
Christoph Galuschka d05160
    then
Christoph Galuschka d05160
    ret_val=0
Christoph Galuschka d05160
  fi
a02188
a02188
  # delete user for local delivery
a02188
  userdel eximtest
a02188
Christoph Galuschka d05160
else
a02188
  t_Log "This is not a C5 system - skipping"
Christoph Galuschka d05160
  ret_val=0
Christoph Galuschka d05160
fi
Christoph Galuschka d05160
Christoph Galuschka d05160
t_CheckExitStatus $ret_val