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.