Maintenance: Not yet arrived email in inbox of email integration tests causes flaky results on CI.

This commit is contained in:
Thorsten Eckel 2021-02-26 11:29:27 +01:00
parent 585bc5e0ea
commit 2db2f3407d
2 changed files with 12 additions and 3 deletions

View file

@ -887,7 +887,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
return
end
Rails.logger.error "Send mail too large postmaster message to: #{reply_mail[:to]}"
Rails.logger.info "Send mail too large postmaster message to: #{reply_mail[:to]}"
reply_mail[:from] = EmailAddress.find_by(channel: channel).email
channel.deliver(reply_mail)
rescue => e

View file

@ -116,8 +116,17 @@ Oversized Email Message Body #{'#' * 120_000}
assert_equal(large_message, eml_data)
# 2. verify that a postmaster response email has been sent to the sender
imap.select('inbox')
message_ids = imap.sort(['DATE'], ['ALL'], 'US-ASCII')
message_ids = nil
5.times do |sleep_offset|
imap.select('inbox')
message_ids = imap.sort(['DATE'], ['ALL'], 'US-ASCII')
break if message_ids.count.positive?
# send mail hasn't arrived yet in the inbox
sleep sleep_offset
end
assert(message_ids.count.positive?, 'Must have received a reply from the postmaster')
imap_message_id = message_ids.last
msg = imap.fetch(imap_message_id, 'RFC822')[0].attr['RFC822']