consistently make 1 the default value for SPAMASSASSIN_SPAM_TO_INBOX (#2361)

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
Christian Raue 2022-02-17 09:31:45 +01:00 committed by GitHub
parent ce9e86c462
commit 908e95fa74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 36 deletions

View file

@ -33,6 +33,7 @@ function setup_file() {
}
@test "checking amavis: spam message is bounced (rejected)" {
# shellcheck disable=SC2034
local TEST_DOCKER_ARGS=(
--env ENABLE_SPAMASSASSIN=1
--env SPAMASSASSIN_SPAM_TO_INBOX=0
@ -40,25 +41,6 @@ function setup_file() {
common_container_setup 'TEST_DOCKER_ARGS'
run _should_emit_warning
assert_failure
_should_bounce_spam
}
@test "checking amavis: spam message is bounced (rejected), undefined SPAMASSASSIN_SPAM_TO_INBOX should raise a warning" {
# SPAMASSASSIN_SPAM_TO_INBOX=0 is the default. If no explicit ENV value is set, it should log a warning at startup.
# shellcheck disable=SC2034
local TEST_DOCKER_ARGS=(
--env ENABLE_SPAMASSASSIN=1
)
common_container_setup 'TEST_DOCKER_ARGS'
run _should_emit_warning
assert_success
_should_bounce_spam
}
@ -66,11 +48,6 @@ function setup_file() {
skip 'this test is only there to reliably mark the end for the teardown_file'
}
# This warning should only be raised when the env SPAMASSASSIN_SPAM_TO_INBOX has no explicit value set
function _should_emit_warning() {
sh -c "docker logs ${TEST_NAME} | grep 'Spam messages WILL NOT BE DELIVERED'"
}
function _should_bounce_spam() {
wait_for_smtp_port_in_container_to_respond "${TEST_NAME}"

View file

@ -23,7 +23,9 @@ setup_file() {
-e ENABLE_MANAGESIEVE=1 \
-e ENABLE_QUOTAS=1 \
-e ENABLE_SPAMASSASSIN=1 \
-e SPAMASSASSIN_SPAM_TO_INBOX=0 \
-e ENABLE_SRS=1 \
-e ENABLE_UPDATE_CHECK=0 \
-e PERMIT_DOCKER=host \
-e REPORT_RECIPIENT=user1@localhost.localdomain \
-e REPORT_SENDER=report1@mail.my-domain.com \
@ -244,6 +246,7 @@ teardown_file() {
assert_success
}
# TODO add a test covering case SPAMASSASSIN_SPAM_TO_INBOX=1 (default)
@test "checking smtp: delivers mail to existing account" {
run docker exec mail /bin/sh -c "grep 'postfix/lmtp' /var/log/mail/mail.log | grep 'status=sent' | grep ' Saved)' | sed 's/.* to=</</g' | sed 's/, relay.*//g' | sort | uniq -c | tr -s \" \""
assert_success
@ -316,6 +319,7 @@ EOF
assert_output 2
}
# TODO add a test covering case SPAMASSASSIN_SPAM_TO_INBOX=1 (default)
@test "checking smtp: rejects spam" {
run docker exec mail /bin/sh -c "grep 'Blocked SPAM' /var/log/mail/mail.log | grep external.tld=spam@my-domain.com | wc -l"
assert_success