mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-23 15:37:01 +00:00
test: Unify (most) SMTP client calls
To send mails, today some tests use msmtp and others our internal smtpc.py. This works, but msmtp slows down the tests significantly, and smtpc.py is also not particularly fast, and also has some limitations. This patch introduces a new SMTP client tool written in Go, and makes almost all the tests use it. Some tests still remain on msmtp, mainly for client-check compatibility. It's likely that this will be moved in later patches to a separate special-purpose test. With this patch, integration tests take ~20% less time than before.
This commit is contained in:
@@ -18,7 +18,7 @@ wait_until_ready 1025
|
||||
|
||||
cp config/hooks/post-data.good config/hooks/post-data
|
||||
|
||||
run_msmtp someone@testserver < content
|
||||
smtpc someone@testserver < content
|
||||
|
||||
wait_for_file .mail/someone@testserver
|
||||
|
||||
@@ -51,20 +51,20 @@ check "SPF_PASS=0"
|
||||
|
||||
# Check that failures in the script result in failing delivery.
|
||||
# Transient failure.
|
||||
if run_msmtp blockme@testserver < content 2>/dev/null; then
|
||||
if smtpc blockme@testserver < content >.logs/smtpc.log 2>&1; then
|
||||
fail "ERROR: hook did not block email as expected"
|
||||
fi
|
||||
if ! tail -n 1 .logs/msmtp | grep -q "smtpstatus=451"; then
|
||||
tail -n 1 .logs/msmtp
|
||||
if ! grep -q "451 ¡No pasarán!" .logs/smtpc.log; then
|
||||
cat .logs/smtpc.log
|
||||
fail "ERROR: transient hook error not returned correctly"
|
||||
fi
|
||||
|
||||
# Permanent failure.
|
||||
if run_msmtp permanent@testserver < content 2>/dev/null; then
|
||||
if smtpc permanent@testserver < content >.logs/smtpc.log 2>&1; then
|
||||
fail "ERROR: hook did not block email as expected"
|
||||
fi
|
||||
if ! tail -n 1 .logs/msmtp | grep -q "smtpstatus=554"; then
|
||||
tail -n 1 .logs/msmtp
|
||||
if ! grep -q "554 Nos hacemos la permanente" .logs/smtpc.log; then
|
||||
cat .logs/smtpc.log
|
||||
fail "ERROR: permanent hook error not returned correctly"
|
||||
fi
|
||||
|
||||
@@ -72,7 +72,7 @@ fi
|
||||
for i in config/hooks/post-data.bad*; do
|
||||
cp "$i" config/hooks/post-data
|
||||
|
||||
run_msmtp someone@testserver < content
|
||||
smtpc someone@testserver < content
|
||||
wait_for_file .mail/someone@testserver
|
||||
mail_diff content .mail/someone@testserver
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user