2019-11-01 18:49:58 +00:00
|
|
|
load 'test_helper/common'
|
|
|
|
|
|
|
|
setup_file() {
|
2020-10-20 07:33:47 +00:00
|
|
|
local PRIVATE_CONFIG
|
2022-05-05 08:28:38 +00:00
|
|
|
PRIVATE_CONFIG=$(duplicate_config_for_container .)
|
2019-11-01 18:49:58 +00:00
|
|
|
docker run -d --name mail_special_use_folders \
|
2022-03-17 10:24:30 +00:00
|
|
|
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
|
|
|
|
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
|
2019-11-01 18:49:58 +00:00
|
|
|
-e SASL_PASSWD="external-domain.com username:password" \
|
|
|
|
-e ENABLE_CLAMAV=0 \
|
|
|
|
-e ENABLE_SPAMASSASSIN=0 \
|
|
|
|
--cap-add=SYS_PTRACE \
|
|
|
|
-e PERMIT_DOCKER=host \
|
2020-11-05 12:32:42 +00:00
|
|
|
-h mail.my-domain.com -t "${NAME}"
|
2019-11-01 18:49:58 +00:00
|
|
|
wait_for_smtp_port_in_container mail_special_use_folders
|
|
|
|
}
|
|
|
|
|
|
|
|
teardown_file() {
|
|
|
|
docker rm -f mail_special_use_folders
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "checking normal delivery" {
|
|
|
|
run docker exec mail_special_use_folders /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
|
|
|
|
assert_success
|
|
|
|
|
2020-11-05 12:32:42 +00:00
|
|
|
# shellcheck disable=SC2016
|
2019-11-01 18:49:58 +00:00
|
|
|
repeat_until_success_or_timeout 30 docker exec mail_special_use_folders /bin/sh -c '[ $(ls /var/mail/localhost.localdomain/user1/new | wc -l) -eq 1 ]'
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "checking special-use folders not yet created" {
|
|
|
|
run docker exec mail_special_use_folders /bin/bash -c "ls -A /var/mail/localhost.localdomain/user1 | grep -E '.Drafts|.Sent|.Trash' | wc -l"
|
|
|
|
assert_success
|
|
|
|
assert_output 0
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "checking special-use folders available in IMAP" {
|
|
|
|
run docker exec mail_special_use_folders /bin/sh -c "nc -w 8 0.0.0.0 143 < /tmp/docker-mailserver-test/nc_templates/imap_special_use_folders.txt | grep -E 'Drafts|Junk|Trash|Sent' | wc -l"
|
|
|
|
assert_success
|
|
|
|
assert_output 4
|
|
|
|
}
|