Apply suggestions from code review

This commit is contained in:
Brennan Kinney 2024-01-20 22:19:03 +13:00 committed by GitHub
parent 7c39c154db
commit 7f825835f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 3 deletions

View File

@ -94,6 +94,7 @@ function _print_mail_log_of_queue_id_from_msgid() {
run echo "${QUEUE_ID}" run echo "${QUEUE_ID}"
assert_line --regexp "^${QUEUE_ID_REGEX}$" assert_line --regexp "^${QUEUE_ID_REGEX}$"
# Postfix specific logs:
_filter_service_log 'mail' "${QUEUE_ID}" _filter_service_log 'mail' "${QUEUE_ID}"
} }
@ -104,5 +105,6 @@ function _print_mail_log_for_msgid() {
local MSG_ID=$(__construct_msgid "${1:?The local-part for MSG_ID was not provided}") local MSG_ID=$(__construct_msgid "${1:?The local-part for MSG_ID was not provided}")
shift 1 shift 1
# Dovecot specific logs:
_filter_service_log 'mail' "msgid=${MSG_ID}" _filter_service_log 'mail' "msgid=${MSG_ID}"
} }

View File

@ -123,7 +123,7 @@ function _send_email_with_msgid() {
local MSG_ID=$(__construct_msgid "${1:?The local-part for MSG_ID was not provided}") local MSG_ID=$(__construct_msgid "${1:?The local-part for MSG_ID was not provided}")
shift 1 shift 1
_send_email "${@}" --header "Message-Id: ${MID}" _send_email "${@}" --header "Message-Id: ${MSG_ID}"
} }
# Send a spam e-mail by utilizing GTUBE. # Send a spam e-mail by utilizing GTUBE.

View File

@ -228,7 +228,7 @@ function _successful() {
@test "redirects mail to external aliases" { @test "redirects mail to external aliases" {
_service_log_should_contain_string 'mail' 'Passed CLEAN {RelayedInbound}' _service_log_should_contain_string 'mail' 'Passed CLEAN {RelayedInbound}'
run bash -c "grep '<user@external.tld> -> <external1@otherdomain.tld>' <<< '${output}'" assert_output --partial '<user@external.tld> -> <external1@otherdomain.tld>'
_should_output_number_of_lines 2 _should_output_number_of_lines 2
# assert_output --partial 'external.tld=user@example.test> -> <external1@otherdomain.tld>' # assert_output --partial 'external.tld=user@example.test> -> <external1@otherdomain.tld>'
} }

View File

@ -33,7 +33,8 @@ function teardown_file() { _default_teardown ; }
assert_success assert_success
} }
@test 'Mail log is error-free' { # TODO: Remove in favor of a common helper method, as described in vmail-id.bats equivalent test-case
@test 'Mail log is error free' {
_service_log_should_not_contain_string 'mail' 'non-null host address bits in' _service_log_should_not_contain_string 'mail' 'non-null host address bits in'
_service_log_should_not_contain_string 'mail' ': error:' _service_log_should_not_contain_string 'mail' ': error:'
} }

View File

@ -58,6 +58,7 @@ function teardown_file() { _default_teardown ; }
_service_log_should_not_contain_string 'mail' '\(!\)connect' _service_log_should_not_contain_string 'mail' '\(!\)connect'
# Postfix: https://github.com/docker-mailserver/docker-mailserver/pull/2597 # Postfix: https://github.com/docker-mailserver/docker-mailserver/pull/2597
# Log line match example: https://github.com/docker-mailserver/docker-mailserver/pull/2598#issuecomment-1141176633
_service_log_should_not_contain_string 'mail' 'using backwards-compatible default setting' _service_log_should_not_contain_string 'mail' 'using backwards-compatible default setting'
# Postgrey: https://github.com/docker-mailserver/docker-mailserver/pull/612#discussion_r117635774 # Postgrey: https://github.com/docker-mailserver/docker-mailserver/pull/612#discussion_r117635774