fixup linters and smaller address errors

This commit is contained in:
georglauterbach 2023-12-31 13:13:21 +01:00
parent 394eace02b
commit 09d623f2bc
No known key found for this signature in database
GPG Key ID: F367F7C43C118578
4 changed files with 11 additions and 7 deletions

View File

@ -45,6 +45,8 @@ function _send_email() {
local TEMPLATE_FILE="/tmp/docker-mailserver-test/emails/${1:?Must provide name of template file}.txt" local TEMPLATE_FILE="/tmp/docker-mailserver-test/emails/${1:?Must provide name of template file}.txt"
echo "CONTAINER: ${CONTAINER_NAME} | COMMAND: swaks --server ${SERVER} --port ${PORT} --helo ${HELO} --from ${FROM} --to ${TO} ${MORE_SWAKS_OPTIONS[*]} --data - < ${TEMPLATE_FILE}" >/tmp/log
_run_in_container_bash "swaks --server ${SERVER} --port ${PORT} --helo ${HELO} --from ${FROM} --to ${TO} ${MORE_SWAKS_OPTIONS[*]} --data - < ${TEMPLATE_FILE}" _run_in_container_bash "swaks --server ${SERVER} --port ${PORT} --helo ${HELO} --from ${FROM} --to ${TO} ${MORE_SWAKS_OPTIONS[*]} --data - < ${TEMPLATE_FILE}"
} }

View File

@ -54,6 +54,6 @@ function teardown_file() { _default_teardown ; }
} }
@test 'rejects virus' { @test 'rejects virus' {
_run_in_container_bash "grep 'Blocked INFECTED' /var/log/mail/mail.log | grep '<example-user@example.test> -> <user1@localhost.localdomain>'" _run_in_container_bash "grep 'Blocked INFECTED' /var/log/mail/mail.log | grep '<user@external.tld> -> <user1@localhost.localdomain>'"
assert_success assert_success
} }

View File

@ -30,7 +30,7 @@ function setup_file() {
assert_success assert_success
# Set default implicit container fallback for helpers: # Set default implicit container fallback for helpers:
CONTAINER_NAME=${CONTAINER_NAME} CONTAINER_NAME=${CONTAINER1_NAME}
} }
function teardown_file() { function teardown_file() {
@ -45,8 +45,9 @@ function teardown_file() {
# Expected postscreen log entry: # Expected postscreen log entry:
assert_output --partial 'Protocol error' assert_output --partial 'Protocol error'
_service_log_should_contain_string 'mail' 'COMMAND PIPELINING' _run_in_container cat /var/log/mail.log
_service_log_should_contain_string 'mail' 'DATA without valid RCPT' assert_output --partial 'COMMAND PIPELINING'
assert_output --partial 'DATA without valid RCPT'
} }
@test "should successfully pass postscreen and get postfix greeting message (respecting postscreen_greet_wait time)" { @test "should successfully pass postscreen and get postfix greeting message (respecting postscreen_greet_wait time)" {
@ -59,5 +60,6 @@ function teardown_file() {
# _print_mail_log_for_id "${MAIL_ID}" # _print_mail_log_for_id "${MAIL_ID}"
# assert_output --partial "stored mail into mailbox 'INBOX'" # assert_output --partial "stored mail into mailbox 'INBOX'"
_service_log_should_contain_string 'mail' 'PASS NEW' _run_in_container cat /var/log/mail.log
assert_output --partial 'PASS NEW'
} }

View File

@ -236,12 +236,12 @@ function setup_file() {
@test "rejects spam" { @test "rejects spam" {
_run_in_container grep 'Blocked SPAM {NoBounceInbound,Quarantined}' /var/log/mail/mail.log _run_in_container grep 'Blocked SPAM {NoBounceInbound,Quarantined}' /var/log/mail/mail.log
assert_success assert_success
assert_output --partial '<example-user@example.test> -> <user1@localhost.localdomain>' assert_output --partial '<user@external.tld> -> <user1@localhost.localdomain>'
_should_output_number_of_lines 1 _should_output_number_of_lines 1
# Amavis log line with SPAMASSASSIN_SPAM_TO_INBOX=0 + grep 'Passed SPAM {RelayedTaggedInbound,Quarantined}' /var/log/mail/mail.log: # Amavis log line with SPAMASSASSIN_SPAM_TO_INBOX=0 + grep 'Passed SPAM {RelayedTaggedInbound,Quarantined}' /var/log/mail/mail.log:
# Amavis log line with SPAMASSASSIN_SPAM_TO_INBOX=1 + grep 'Blocked SPAM {NoBounceInbound,Quarantined}' /var/log/mail/mail.log: # Amavis log line with SPAMASSASSIN_SPAM_TO_INBOX=1 + grep 'Blocked SPAM {NoBounceInbound,Quarantined}' /var/log/mail/mail.log:
# <example-user@example.test> -> <user1@localhost.localdomain> # <user@external.tld> -> <user1@localhost.localdomain>
# Amavis log line with ENABLE_SRS=1 changes the domain-part to match in a log: # Amavis log line with ENABLE_SRS=1 changes the domain-part to match in a log:
# <SRS0=g+ca=5C=external.tld=spam@example.test> -> <user1@localhost.localdomain> # <SRS0=g+ca=5C=external.tld=spam@example.test> -> <user1@localhost.localdomain>
# assert_output --partial 'external.tld=spam@example.test> -> <user1@localhost.localdomain>' # assert_output --partial 'external.tld=spam@example.test> -> <user1@localhost.localdomain>'