diff --git a/tests/p_dovecot/dovecot_imap_login.sh b/tests/p_dovecot/dovecot_imap_login.sh index 7c88962..b486eca 100755 --- a/tests/p_dovecot/dovecot_imap_login.sh +++ b/tests/p_dovecot/dovecot_imap_login.sh @@ -13,19 +13,17 @@ chown -R imaptest:imaptest /home/imaptest/mail ret_val=1 t_Log "Dovecot IMAP login test" -# after a restart of dovecot this always results with -# 'imap-login: Disconnected (no auth attempts)' in /var/log/maillog -# first try will be ignored -echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." -# and we need some time between login attempts -sleep 3 +# EL7 comes with nmap-nc , different from nc so different options to use -echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." -# let's see if a third iteration reduces flakyness of the test -sleep 3 +if [ "$centos_ver" = "7" ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + +echo -e "01 LOGIN imaptest imaptest\n" | nc ${nc_options} localhost 143 | grep -q "Logged in." -echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." ret_val=$? if [ $ret_val != 0 ] diff --git a/tests/p_dovecot/dovecot_pop3_login.sh b/tests/p_dovecot/dovecot_pop3_login.sh index 4ac3320..a12056e 100755 --- a/tests/p_dovecot/dovecot_pop3_login.sh +++ b/tests/p_dovecot/dovecot_pop3_login.sh @@ -11,7 +11,16 @@ mkdir -m 700 -p /home/pop3test/mail/.imap/INBOX chown -R pop3test:pop3test /home/pop3test/mail/.imap/INBOX t_Log "Dovecot POP3 login test" -echo -e "user pop3test\npass pop3test\n" | nc -w 5 localhost 110 | grep -q "+OK Logged in." +# EL7 comes with nmap-nc , different from nc so different options to use + +if [ "$centos_ver" = "7" ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + + +echo -e "user pop3test\npass pop3test\n" | nc ${nc_options} localhost 110 | grep -q "+OK Logged in." t_CheckExitStatus $?