1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-03 17:17:29 +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:
Alberto Bertogli
2024-03-09 19:10:08 +00:00
parent 7f44db008d
commit 5eded4edc3
54 changed files with 281 additions and 331 deletions

View File

@@ -1,5 +1,6 @@
smtp_address: ":1025"
submission_address: ":1587"
submission_over_tls_address: ":1465"
monitoring_address: ":1099"
mail_delivery_agent_bin: "test-mda"

View File

@@ -9,25 +9,23 @@ set -e
init
skip_if_python_is_too_old
generate_certs_for ñoños
# Intentionally have a config directory for upper case; this should be
# normalized to lowercase internally (and match the cert accordingly).
add_user ñandú@ñoñOS araño
add_user ñangapirí@ñoñOS antaño
# Python doesn't support UTF8 for auth, use an ascii user and domain.
add_user nada@nada nada
mkdir -p .logs
chasquid -v=2 --logfile=.logs/chasquid.log --config_dir=config &
wait_until_ready 1025
wait_until_ready 1465
# The envelope from and to are taken from the content, and use a mix of upper
# and lower case.
smtpc.py --server=localhost:1025 --user=nada@nada --password=nada \
< content
# Use a mix of upper and lower case in the from, to, and username, to check
# normalization is well handled end-to-end.
smtpc --addr=localhost:1465 \
--server_cert=config/certs/ñoños/fullchain.pem \
--user=ñanDÚ@ñoños --password=araño \
Ñangapirí@Ñoños < content
# The MDA should see the normalized users and domains, in lower case.
wait_for_file .mail/ñangapirí@ñoños