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

@@ -120,10 +120,6 @@ function run_msmtp() {
"${UTILDIR}/.msmtp-bin" -C msmtprc "$@"
}
function smtpc.py() {
"${UTILDIR}/smtpc.py" "$@"
}
function mail_diff() {
"${UTILDIR}/mail_diff" "$@"
}
@@ -158,6 +154,11 @@ function fexp() {
"${UTILDIR}/fexp/fexp" "$@"
}
function smtpc() {
go-build-cached "${UTILDIR}/smtpc/"
"${UTILDIR}/smtpc/smtpc" "$@"
}
function timeout() {
MYPID=$$
(
@@ -232,16 +233,6 @@ function generate_certs_for() {
cp -p "${CACHEDIR}/$1"/* "${CONFDIR}/certs/$1/"
}
# Check the Python version, and skip if it's too old.
# This will check against the version required for smtpc.py.
function skip_if_python_is_too_old() {
# We need Python >= 3.5 to be able to use SMTPUTF8.
check='import sys; sys.exit(0 if sys.version_info >= (3, 5) else 1)'
if ! python3 -c "${check}" > /dev/null 2>&1; then
skip "python3 >= 3.5 not available"
fi
}
function chasquid_ram_peak() {
# Find the pid of the daemon, which we expect is running on the
# background somewhere within our current session.