Fix tests (apply suggestions from code review)

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
Kirill Kirilenko 2024-03-05 15:05:26 +03:00
parent 51823d30c6
commit 47f87f9274
2 changed files with 27 additions and 5 deletions

View File

@ -0,0 +1,21 @@
#!/bin/bash
##
# This user script will be executed between configuration and starting daemons
# To enable it you must save it in your config directory as "user-patches.sh"
##
echo "[user-patches.sh] Adjusting 'Junk' mailbox name to verify special-use flag delivers to modified mailbox folder name"
sed -i -e 's/mailbox Junk/mailbox Spam/' /etc/dovecot/conf.d/15-mailboxes.conf
### Before / After ###
# mailbox Junk {
# auto = subscribe
# special_use = \Junk
# }
# mailbox Spam {
# auto = subscribe
# special_use = \Junk
# }

View File

@ -52,6 +52,8 @@ function teardown() { _default_teardown ; }
@test "(enabled + MOVE_SPAM_TO_JUNK=1) should deliver spam message into Junk mailbox" {
export CONTAINER_NAME=${CONTAINER3_NAME}
_init_with_defaults
local CUSTOM_SETUP_ARGUMENTS=(
--env ENABLE_AMAVIS=1
--env ENABLE_SPAMASSASSIN=1
@ -60,12 +62,11 @@ function teardown() { _default_teardown ; }
--env MOVE_SPAM_TO_JUNK=1
--env PERMIT_DOCKER=container
)
_init_with_defaults
# Adjust 'Junk' mailbox name to verify special-use flag delivers to modified mailbox folder name
mv "${TEST_TMP_CONFIG}/junk-mailbox/user-patches.sh" "${TEST_TMP_CONFIG}/"
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
_run_in_container sed -i -e 's/mailbox Junk/mailbox Spam/' /etc/dovecot/conf.d/15-mailboxes.conf
assert_success
_run_in_container dovecot reload
assert_success
_should_send_spam_message
_should_be_received_by_amavis 'Passed SPAM {RelayedTaggedInbound,Quarantined}'