1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +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

@@ -1,5 +1,6 @@
smtp_address: ":2025"
submission_address: ":2587"
submission_over_tls_address: ":2465"
monitoring_address: ":2099"
mail_delivery_agent_bin: "test-mda"

View File

@@ -8,8 +8,6 @@ check_hostaliases
rm -rf .data-A .data-B .mail
skip_if_python_is_too_old
# Build with the DNS override, so we can fake DNS records.
export GOTAGS="dnsoverride"
@@ -37,20 +35,22 @@ chasquid -v=2 --logfile=.logs-B/chasquid.log --config_dir=B \
--testing__dns_addr=127.0.0.1:9053 \
--testing__outgoing_smtp_port=1025 &
wait_until_ready 1025
wait_until_ready 2025
wait_until_ready 1465
wait_until_ready 2465
wait_until_ready 9053
# Send from A to B.
smtpc.py --server=localhost:1025 --user=nadaA@nadaA --password=nadaA \
< from_A_to_B
smtpc --addr=localhost:1465 --user=nadaA@nadaA --password=nadaA \
--server_cert=A/certs/srv-ñ/fullchain.pem \
pingüino@srv-ü < from_A_to_B
wait_for_file .mail/pingüino@srv-ü
mail_diff from_A_to_B .mail/pingüino@srv-ü
# Send from B to A.
smtpc.py --server=localhost:2025 --user=nadaB@nadaB --password=nadaB \
< from_B_to_A
smtpc --addr=localhost:2465 --user=nadaB@nadaB --password=nadaB \
--server_cert=B/certs/srv-ü/fullchain.pem \
ñangapirí@srv-ñ < from_B_to_A
wait_for_file .mail/ñangapirí@srv-ñ
mail_diff from_B_to_A .mail/ñangapirí@srv-ñ