From a0530aa0c280e875464aaf933eddc47e55d07f49 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Oct 20 2012 19:52:14 +0000 Subject: possible fix for dovecot imap test: first login after service restart always fails, therefore first login will be ignored, after a 'sleep' login will be retried. --- diff --git a/tests/p_dovecot/dovecot_imap_login.sh b/tests/p_dovecot/dovecot_imap_login.sh index 94b4891..e74f1b9 100755 --- a/tests/p_dovecot/dovecot_imap_login.sh +++ b/tests/p_dovecot/dovecot_imap_login.sh @@ -8,21 +8,21 @@ t_Log "Running $0 - adding imaptest local user account + attempting IMAP login" # creating maildir in HOME, else test will fail at first try mkdir -m 700 -p /home/imaptest/mail/.imap/INBOX -chown -R imaptest:imaptest /home/imaptest/mail/.imap/INBOX +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." -ret_val=$? -if [ $ret_val == 1 ] - then - t_Log "Sometimes the first login fails (reason yet unknown to me)" - t_Log "Trying a second time, as this seems to work, if not somethings really not working" - echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." - ret_val=$? -fi +# and we need some time between login attempts +sleep 3 + +echo -e "01 LOGIN imaptest imaptest\n" | nc -w 5 localhost 143 | grep -q "Logged in." +ret_val=$? t_CheckExitStatus $ret_val