tests: small adjustments (#3772)

This commit is contained in:
Georg Lauterbach 2024-01-14 23:14:03 +01:00 committed by GitHub
parent f794f65caa
commit 3a142f9726
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 23 deletions

View file

@ -141,14 +141,12 @@ function _send_email_and_get_id() {
# Get rid of ${1} so only the arguments for swaks remain
shift 1
local QUEUE_ID
# The unique ID Postfix (and other services) use may be different in length
# on different systems (e.g. amd64 (11) vs aarch64 (10)). Hence, we use a
# range to safely capture it.
# on different systems. Hence, we use a range to safely capture it.
local QUEUE_ID_REGEX='[A-Z0-9]{9,12}'
_wait_for_empty_mail_queue_in_container
local OUTPUT=$(_send_email "${@}" --header "Message-Id: ${MID}")
_send_email "${@}" --header "Message-Id: ${MID}"
_wait_for_empty_mail_queue_in_container
# We store Postfix's queue ID first
@ -164,3 +162,12 @@ function _send_email_and_get_id() {
run echo "${ID_ENV_VAR_REF}"
assert_line --regexp "^${QUEUE_ID_REGEX}\|${MID}$"
}
# Send a spam e-mail by utilizing GTUBE.
#
# Extra arguments given to this function will be supplied by `_send_email_and_get_id` directly.
function _send_spam() {
_send_email_and_get_id MAIL_ID_SPAM "${@}" \
--from 'spam@external.tld' \
--body 'XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X'
}