mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-28 20:56:03 +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:
@@ -47,7 +47,10 @@ wait_until_ready 1025
|
||||
|
||||
# Authenticated: user@testserver -> someone@testserver
|
||||
# Should be signed.
|
||||
run_msmtp someone@testserver < content
|
||||
smtpc --addr=localhost:1465 \
|
||||
--server_cert=config/certs/testserver/fullchain.pem \
|
||||
--user=user@testserver --password=secretpassword \
|
||||
someone@testserver < content
|
||||
wait_for_file .mail/someone@testserver
|
||||
mail_diff content .mail/someone@testserver
|
||||
if ! grep -q "DKIM-Signature:" .mail/someone@testserver; then
|
||||
@@ -65,11 +68,14 @@ dkimverify -txt .dkimcerts/private.dns < .mail/someone@testserver
|
||||
tail -n +2 .mail/someone@testserver > .signed_content
|
||||
|
||||
# Not authenticated: someone@testserver -> someone@testserver
|
||||
smtpc.py --server=localhost:1025 < .signed_content
|
||||
smtpc --addr=localhost:1025 \
|
||||
--from=someone@testserver someone@testserver < .signed_content
|
||||
|
||||
# Check that the signature fails on modified content.
|
||||
echo "Added content, invalid and not signed" >> .signed_content
|
||||
if smtpc.py --server=localhost:1025 < .signed_content 2> /dev/null; then
|
||||
if smtpc --addr=localhost:1025 \
|
||||
--from=someone@testserver someone@testserver < .signed_content \
|
||||
> /dev/null 2>&1 ; then
|
||||
fail "DKIM verification succeeded on modified content"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user