From ab680c8e75791d96ef66367277194c085371e55c Mon Sep 17 00:00:00 2001 From: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> Date: Sat, 28 Mar 2026 21:44:53 +0100 Subject: [PATCH] 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> --- test/helper/common.bash | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/helper/common.bash b/test/helper/common.bash index b00a23e4..8f2fa218 100644 --- a/test/helper/common.bash +++ b/test/helper/common.bash @@ -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.