tests(fix): make _nc_wrapper more "compliant" with SMTP

Postfix 3.10 is stricter when it comes to command pipelining; we now
need to account for it. I know that the solution is far from perfect,
but I currently see no other way. If someone has a better idea, please
provide a solution, but do not complain without a solution.

Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Georg Lauterbach 2026-03-28 21:44:53 +01:00
parent 04ef7eab93
commit ab680c8e75
No known key found for this signature in database

View File

@ -423,7 +423,23 @@ function _nc_wrapper() {
[[ -v CONTAINER_NAME ]] || return 1
_run_in_container_bash "nc ${NC_PARAMETERS} < /tmp/docker-mailserver-test/${FILE}"
# Since Postfix 3.10, stricter SMTP protocol compliance is enforced
# (specifically around command pipelining). Without the additional
# `sleep`, we would see issues like
#
# postfix/submissions/smtpd[...]: improper command pipelining after CONNECT
#
# The solution here is **fragile**, but since `swaks` does not implement
# everything that we need for our tests (yet), we are forced to keep this
# workaround.. If you do not like this solution, please provide a better
# alternative.
#
# Having the `sleep` in front of the `echo` is also important for SMTP
# protocol synchronization. If you write the `sleep` after the `echo`,
# you would see
#
# 554 5.5.0 Error: SMTP protocol synchronization
_run_in_container_bash "while read -r LINE; do sleep 0.5s; echo \"\${LINE}\"; done < /tmp/docker-mailserver-test/${FILE} | nc ${NC_PARAMETERS}"
}
# A simple wrapper for a test that checks whether a file exists.