tests: refactor POP3, IMAP (actually SASLauthd + RIMAP) & relay (#3062)

* refactor `mail_pop3.bats`
* refactor `mail_with_imap.bats`
* refactor `mail_with_relays.bats`
* moved test that that did not belong into POP3 test
* slightly clean up `no_container.bats`

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
Georg Lauterbach 2023-02-06 23:59:01 +01:00 committed by GitHub
parent 4efbbbe571
commit 2caec2cdf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 134 additions and 156 deletions

View file

@ -1,7 +1,7 @@
load "${REPOSITORY_ROOT}/test/helper/common"
load "${REPOSITORY_ROOT}/test/helper/setup"
BATS_TEST_NAME_PREFIX='[Amavis] '
BATS_TEST_NAME_PREFIX='[Amavis + SA] '
CONTAINER_NAME='dms-test_amavis'
function setup_file() {
@ -18,10 +18,29 @@ function setup_file() {
function teardown_file() { _default_teardown ; }
@test "SpamAssassin integration should be active" {
@test 'SpamAssassin integration should be active' {
# give Amavis just a bit of time to print out its full debug log
run _repeat_in_container_until_success_or_timeout 5 "${CONTAINER_NAME}" grep 'ANTI-SPAM-SA' /var/log/mail/mail.log
assert_success
assert_output --partial 'loaded'
refute_output --partial 'NOT loaded'
}
@test 'SA ENV should update Amavis config' {
local AMAVIS_DEFAULTS_FILE='/etc/amavis/conf.d/20-debian_defaults'
_run_in_container grep '\$sa_tag_level_deflt' "${AMAVIS_DEFAULTS_FILE}"
assert_success
assert_output --partial '= 2.0'
_run_in_container grep '\$sa_tag2_level_deflt' "${AMAVIS_DEFAULTS_FILE}"
assert_success
assert_output --partial '= 6.31'
_run_in_container grep '\$sa_kill_level_deflt' "${AMAVIS_DEFAULTS_FILE}"
assert_success
assert_output --partial '= 6.31'
_run_in_container grep '\$sa_spam_subject_tag' "${AMAVIS_DEFAULTS_FILE}"
assert_success
assert_output --partial "= '***SPAM*** ';"
}