mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Give each container their own private config folder
This commit is contained in:
parent
e5d04aa30d
commit
5fef8a5b78
|
@ -2,7 +2,7 @@ load 'test_helper/common'
|
|||
|
||||
function setup() {
|
||||
docker run -d --name mail_with_default_relay \
|
||||
-v "`pwd`/test/config/relay-hosts":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container relay-hosts/)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DEFAULT_RELAY_HOST=default.relay.host.invalid:25 \
|
||||
--cap-add=SYS_PTRACE \
|
||||
|
|
|
@ -22,7 +22,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_default_dhparams_one_dir \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_default_dhparams_both_one_dir)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=0 \
|
||||
-e ONE_DIR=1 \
|
||||
|
@ -30,7 +30,7 @@ function setup_file() {
|
|||
wait_for_finished_setup_in_container mail_default_dhparams_one_dir
|
||||
|
||||
docker run -d --name mail_default_dhparams_not_one_dir \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_default_dhparams_both_not_one_dir)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=0 \
|
||||
-e ONE_DIR=0 \
|
||||
|
|
|
@ -21,11 +21,12 @@ function teardown() {
|
|||
}
|
||||
|
||||
function setup_file() {
|
||||
private_config=$(duplicate_config_for_container .)
|
||||
# copy the custom DHE params in local config
|
||||
cp "`pwd`/test/test-files/ssl/custom-dhe-params.pem" "`pwd`/test/config/dhparams.pem"
|
||||
cp "`pwd`/test/test-files/ssl/custom-dhe-params.pem" "$private_config/dhparams.pem"
|
||||
|
||||
docker run -d --name mail_manual_dhparams_not_one_dir \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$private_config":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=0 \
|
||||
-e ONE_DIR=0 \
|
||||
|
@ -34,8 +35,6 @@ function setup_file() {
|
|||
}
|
||||
|
||||
function teardown_file() {
|
||||
# remove custom dhe file
|
||||
rm "`pwd`/test/config/dhparams.pem"
|
||||
docker rm -f mail_manual_dhparams_not_one_dir
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_manual_dhparams_one_dir \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-v "`pwd`/test/test-files/ssl/custom-dhe-params.pem":/var/mail-state/lib-shared/dhparams.pem:ro \
|
||||
-e DMS_DEBUG=0 \
|
||||
|
|
|
@ -10,7 +10,7 @@ teardown() {
|
|||
|
||||
setup_file() {
|
||||
docker run --rm -d --name mail_disabled_clamav_spamassassin \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_CLAMAV=0 \
|
||||
-e ENABLE_SPAMASSASSIN=0 \
|
||||
|
|
|
@ -10,7 +10,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run --rm -d --name mail_fail2ban \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_FAIL2BAN=1 \
|
||||
-e POSTSCREEN_ACTION=ignore \
|
||||
|
|
|
@ -10,7 +10,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_fetchmail \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_FETCHMAIL=1 \
|
||||
--cap-add=NET_ADMIN \
|
||||
|
|
|
@ -10,8 +10,8 @@ teardown() {
|
|||
|
||||
setup_file() {
|
||||
docker run -d --name mail_lmtp_ip \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/config/dovecot-lmtp":/etc/dovecot \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container dovecot-lmtp/ mail_lmtp_ip_dovecot-lmtp)":/etc/dovecot \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_POSTFIX_VIRTUAL_TRANSPORT=1 \
|
||||
-e POSTFIX_DAGENT=lmtp:127.0.0.1:24 \
|
||||
|
|
|
@ -6,7 +6,7 @@ function setup() {
|
|||
|
||||
function setup_file() {
|
||||
docker run --rm -d --name mail_override_hostname \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e PERMIT_DOCKER=network \
|
||||
-e DMS_DEBUG=0 \
|
||||
|
|
|
@ -10,7 +10,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_pop3 \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_POP3=1 \
|
||||
-e DMS_DEBUG=0 \
|
||||
|
|
|
@ -15,14 +15,14 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_postfix_inet_default \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_postfix_inet_default)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-h mail.my-domain.com -t "${NAME}"
|
||||
|
||||
wait_for_finished_setup_in_container mail_postfix_inet_default
|
||||
|
||||
docker run -d --name mail_postfix_inet_all \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_postfix_inet_all)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e POSTFIX_INET_PROTOCOLS=all \
|
||||
-h mail.my-domain.com -t "${NAME}"
|
||||
|
@ -30,7 +30,7 @@ function setup_file() {
|
|||
wait_for_finished_setup_in_container mail_postfix_inet_all
|
||||
|
||||
docker run -d --name mail_postfix_inet_ipv4 \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_postfix_inet_ipv4)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e POSTFIX_INET_PROTOCOLS=ipv4 \
|
||||
-h mail.my-domain.com -t "${NAME}"
|
||||
|
@ -38,7 +38,7 @@ function setup_file() {
|
|||
wait_for_finished_setup_in_container mail_postfix_inet_ipv4
|
||||
|
||||
docker run -d --name mail_postfix_inet_ipv6 \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_postfix_inet_ipv6)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e POSTFIX_INET_PROTOCOLS=ipv6 \
|
||||
-h mail.my-domain.com -t "${NAME}"
|
||||
|
|
|
@ -13,7 +13,7 @@ teardown() {
|
|||
|
||||
setup_file() {
|
||||
docker run -d --name mail_postscreen \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e POSTSCREEN_ACTION=enforce \
|
||||
--cap-add=NET_ADMIN \
|
||||
|
|
|
@ -10,7 +10,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_privacy \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SASL_PASSWD="external-domain.com username:password" \
|
||||
-e ENABLE_MANAGESIEVE=1 \
|
||||
|
|
|
@ -15,7 +15,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_no_quotas \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=0 \
|
||||
-e ENABLE_QUOTAS=0 \
|
||||
|
|
|
@ -10,7 +10,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run --rm -d --name mail_smtponly \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SMTP_ONLY=1 \
|
||||
-e PERMIT_DOCKER=network \
|
||||
|
|
|
@ -15,7 +15,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_spam_bounced_defined \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_spam_bounced_defined)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_SPAMASSASSIN=1 \
|
||||
-e SPAMASSASSIN_SPAM_TO_INBOX=0 \
|
||||
|
@ -24,7 +24,7 @@ function setup_file() {
|
|||
wait_for_finished_setup_in_container mail_spam_bounced_defined
|
||||
|
||||
docker run -d --name mail_spam_bounced_undefined \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_spam_bounced_defined)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_SPAMASSASSIN=1 \
|
||||
-h mail.my-domain.com -t "${NAME}"
|
||||
|
|
|
@ -15,7 +15,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_spam_moved_junk \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_spam_moved_junk)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_SPAMASSASSIN=1 \
|
||||
-e SPAMASSASSIN_SPAM_TO_INBOX=1 \
|
||||
|
@ -26,7 +26,7 @@ function setup_file() {
|
|||
wait_for_finished_setup_in_container mail_spam_moved_junk
|
||||
|
||||
docker run -d --name mail_spam_moved_new \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_spam_moved_new)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_SPAMASSASSIN=1 \
|
||||
-e SPAMASSASSIN_SPAM_TO_INBOX=1 \
|
||||
|
|
|
@ -10,7 +10,7 @@ teardown() {
|
|||
|
||||
setup_file() {
|
||||
docker run -d --name mail_special_use_folders \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SASL_PASSWD="external-domain.com username:password" \
|
||||
-e ENABLE_CLAMAV=0 \
|
||||
|
|
|
@ -2,7 +2,7 @@ load 'test_helper/common'
|
|||
|
||||
@test "checking SRS: SRS_DOMAINNAME is used correctly" {
|
||||
docker run --rm -d --name mail_srs_domainname \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_srs_domainname)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e PERMIT_DOCKER=network \
|
||||
-e DMS_DEBUG=0 \
|
||||
|
@ -19,7 +19,7 @@ load 'test_helper/common'
|
|||
|
||||
@test "checking SRS: DOMAINNAME is handled correctly" {
|
||||
docker run --rm -d --name mail_domainname \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_domainname)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e PERMIT_DOCKER=network \
|
||||
-e DMS_DEBUG=0 \
|
||||
|
|
|
@ -9,28 +9,31 @@ function teardown() {
|
|||
}
|
||||
|
||||
function setup_file() {
|
||||
private_config="$(duplicate_config_for_container . mail_lets_domain)"
|
||||
docker run -d --name mail_lets_domain \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$private_config":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-v "`pwd`/test/config/letsencrypt/my-domain.com":/etc/letsencrypt/live/my-domain.com \
|
||||
-v "$private_config/letsencrypt/my-domain.com":/etc/letsencrypt/live/my-domain.com \
|
||||
-e DMS_DEBUG=0 \
|
||||
-e SSL_TYPE=letsencrypt \
|
||||
-h mail.my-domain.com -t ${NAME}
|
||||
wait_for_finished_setup_in_container mail_lets_domain
|
||||
|
||||
private_config="$(duplicate_config_for_container . mail_lets_hostname)"
|
||||
docker run -d --name mail_lets_hostname \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$private_config":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-v "`pwd`/test/config/letsencrypt/mail.my-domain.com":/etc/letsencrypt/live/mail.my-domain.com \
|
||||
-v "$private_config/letsencrypt/mail.my-domain.com":/etc/letsencrypt/live/mail.my-domain.com \
|
||||
-e DMS_DEBUG=0 \
|
||||
-e SSL_TYPE=letsencrypt \
|
||||
-h mail.my-domain.com -t ${NAME}
|
||||
wait_for_finished_setup_in_container mail_lets_hostname
|
||||
|
||||
cp "`pwd`/test/config/letsencrypt/acme.json" "`pwd`/test/config/acme.json"
|
||||
private_config="$(duplicate_config_for_container . mail_lets_acme_json)"
|
||||
cp "$(private_config_path mail_lets_acme_json)/letsencrypt/acme.json" "$(private_config_path mail_lets_acme_json)/acme.json"
|
||||
docker run -d --name mail_lets_acme_json \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/config/acme.json":/etc/letsencrypt/acme.json:ro \
|
||||
-v "$private_config":/tmp/docker-mailserver \
|
||||
-v "$private_config/acme.json":/etc/letsencrypt/acme.json:ro \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=0 \
|
||||
-e SSL_TYPE=letsencrypt \
|
||||
|
@ -44,7 +47,6 @@ function teardown_file() {
|
|||
docker rm -f mail_lets_domain
|
||||
docker rm -f mail_lets_hostname
|
||||
docker rm -f mail_lets_acme_json
|
||||
rm "`pwd`/test/config/acme.json"
|
||||
}
|
||||
|
||||
# this test must come first to reliably identify when to run setup_file
|
||||
|
@ -103,16 +105,16 @@ function teardown_file() {
|
|||
|
||||
@test "can extract certs from acme.json" {
|
||||
run docker exec mail_lets_acme_json /bin/bash -c "cat /etc/letsencrypt/live/mail.my-domain.com/key.pem"
|
||||
assert_output "$(cat "`pwd`/test/config/letsencrypt/mail.my-domain.com/privkey.pem")"
|
||||
assert_output "$(cat "$(private_config_path mail_lets_acme_json)/letsencrypt/mail.my-domain.com/privkey.pem")"
|
||||
assert_success
|
||||
|
||||
run docker exec mail_lets_acme_json /bin/bash -c "cat /etc/letsencrypt/live/mail.my-domain.com/fullchain.pem"
|
||||
assert_output "$(cat "`pwd`/test/config/letsencrypt/mail.my-domain.com/fullchain.pem")"
|
||||
assert_output "$(cat "$(private_config_path mail_lets_acme_json)/letsencrypt/mail.my-domain.com/fullchain.pem")"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "can detect changes" {
|
||||
cp "`pwd`/test/config/letsencrypt/acme-changed.json" "`pwd`/test/config/acme.json"
|
||||
cp "$(private_config_path mail_lets_acme_json)/letsencrypt/acme-changed.json" "$(private_config_path mail_lets_acme_json)/acme.json"
|
||||
sleep 11
|
||||
run docker exec mail_lets_acme_json /bin/bash -c "supervisorctl tail changedetector"
|
||||
assert_output --partial "Cert found in /etc/letsencrypt/acme.json for *.example.com"
|
||||
|
@ -121,11 +123,11 @@ function teardown_file() {
|
|||
assert_output --partial "Change detected"
|
||||
|
||||
run docker exec mail_lets_acme_json /bin/bash -c "cat /etc/letsencrypt/live/mail.my-domain.com/key.pem"
|
||||
assert_output "$(cat "`pwd`/test/config/letsencrypt/changed/key.pem")"
|
||||
assert_output "$(cat "$(private_config_path mail_lets_acme_json)/letsencrypt/changed/key.pem")"
|
||||
assert_success
|
||||
|
||||
run docker exec mail_lets_acme_json /bin/bash -c "cat /etc/letsencrypt/live/mail.my-domain.com/fullchain.pem"
|
||||
assert_output "$(cat "`pwd`/test/config/letsencrypt/changed/fullchain.pem")"
|
||||
assert_output "$(cat "$(private_config_path mail_lets_acme_json)/letsencrypt/changed/fullchain.pem")"
|
||||
assert_success
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_manual_ssl \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SSL_TYPE=manual \
|
||||
-e SSL_CERT_PATH=/tmp/docker-mailserver/letsencrypt/mail.my-domain.com/fullchain.pem \
|
||||
|
|
|
@ -2,13 +2,13 @@ load 'test_helper/common'
|
|||
|
||||
function setup() {
|
||||
docker run -d --name mail_undef_spam_subject \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_SPAMASSASSIN=1 \
|
||||
-e SA_SPAM_SUBJECT="undef" \
|
||||
-h mail.my-domain.com -t ${NAME}
|
||||
CONTAINER=$(docker run -d \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_undef_spam_subject_2)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-v "`pwd`/test/onedir":/var/mail-state \
|
||||
-e ENABLE_CLAMAV=1 \
|
||||
|
|
|
@ -11,7 +11,7 @@ teardown() {
|
|||
|
||||
setup_file() {
|
||||
docker run -d --name mail_with_imap \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_SASLAUTHD=1 \
|
||||
-e SASLAUTHD_MECHANISMS=rimap \
|
||||
|
|
|
@ -18,7 +18,7 @@ function setup_file() {
|
|||
-h ldap.my-domain.com -t ldap
|
||||
|
||||
docker run -d --name mail_with_ldap \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_LDAP=1 \
|
||||
-e LDAP_SERVER_HOST=ldap \
|
||||
|
|
|
@ -10,7 +10,7 @@ teardown() {
|
|||
|
||||
setup_file() {
|
||||
docker run -d --name mail_with_mdbox_format \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SASL_PASSWD="external-domain.com username:password" \
|
||||
-e ENABLE_CLAMAV=0 \
|
||||
|
|
|
@ -10,7 +10,7 @@ function teardown() {
|
|||
|
||||
function setup_file() {
|
||||
docker run -d --name mail_with_postgrey \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e ENABLE_POSTGREY=1 \
|
||||
-e POSTGREY_DELAY=15 \
|
||||
|
|
|
@ -2,7 +2,7 @@ load 'test_helper/common'
|
|||
|
||||
function setup() {
|
||||
CONTAINER=$(docker run -d \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e DMS_DEBUG=0 \
|
||||
-h mail.my-domain.com -t ${NAME})
|
||||
|
|
|
@ -10,7 +10,7 @@ teardown() {
|
|||
|
||||
setup_file() {
|
||||
docker run -d --name mail_with_sdbox_format \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SASL_PASSWD="external-domain.com username:password" \
|
||||
-e ENABLE_CLAMAV=0 \
|
||||
|
|
|
@ -8,7 +8,7 @@ setup() {
|
|||
# currently we cannot use --network in `docker run` multiple times, it will just use the last one
|
||||
# instead we need to use create, network connect and start (see https://success.docker.com/article/multiple-docker-networks)
|
||||
docker create --name mail_smtponly_second_network \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_smtponly_second_network)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SMTP_ONLY=1 \
|
||||
-e PERMIT_DOCKER=connected-networks \
|
||||
|
@ -19,7 +19,7 @@ setup() {
|
|||
docker network connect ${NON_DEFAULT_DOCKER_MAIL_NETWORK_NAME}2 mail_smtponly_second_network
|
||||
docker start mail_smtponly_second_network
|
||||
docker run -d --name mail_smtponly_second_network_sender \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$(duplicate_config_for_container . mail_smtponly_second_network_sender)":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-e SMTP_ONLY=1 \
|
||||
-e PERMIT_DOCKER=connected-networks \
|
||||
|
|
|
@ -105,3 +105,19 @@ function run_teardown_file_if_necessary() {
|
|||
teardown_file
|
||||
fi
|
||||
}
|
||||
|
||||
# get the private config path for the given container or test file, if no container name was given
|
||||
function private_config_path() {
|
||||
echo "$PWD/test/duplicate_configs/${1:$BATS_TEST_FILENAME}"
|
||||
}
|
||||
|
||||
# @param $1 relative source in test/config folder
|
||||
# @param $2 (optional) container name, defaults to $BATS_TEST_FILENAME
|
||||
# @return path to the folder where the config is duplicated
|
||||
function duplicate_config_for_container() {
|
||||
output="$(private_config_path "$2")"
|
||||
rm -rf "$output" # cleanup
|
||||
mkdir -p "$output"
|
||||
cp -r "$PWD/test/config/$1" "$output"
|
||||
echo "$output"
|
||||
}
|
118
test/tests.bats
118
test/tests.bats
|
@ -7,11 +7,12 @@ setup() {
|
|||
}
|
||||
|
||||
setup_file() {
|
||||
private_config="$(duplicate_config_for_container . mail)"
|
||||
docker run --rm -d --name mail \
|
||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||
-v "$private_config":/tmp/docker-mailserver \
|
||||
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
||||
-v "`pwd`/test/onedir":/var/mail-state \
|
||||
-v "`pwd`/test/config/user-patches/user-patches.sh":/tmp/docker-mailserver/user-patches.sh \
|
||||
-v "$private_config/user-patches/user-patches.sh":/tmp/docker-mailserver/user-patches.sh \
|
||||
-e ENABLE_CLAMAV=1 \
|
||||
-e SPOOF_PROTECTION=1 \
|
||||
-e ENABLE_SPAMASSASSIN=1 \
|
||||
|
@ -32,7 +33,7 @@ setup_file() {
|
|||
# generate account after run
|
||||
docker exec mail addmailuser pass@localhost.localdomain 'may be \a `p^a.*ssword'
|
||||
# setup sieve
|
||||
repeat_until_success_or_timeout 15 docker cp "`pwd`/test/config/sieve/dovecot.sieve" mail:/var/mail/localhost.localdomain/user1/.dovecot.sieve
|
||||
repeat_until_success_or_timeout 15 docker cp "$private_config/sieve/dovecot.sieve" mail:/var/mail/localhost.localdomain/user1/.dovecot.sieve
|
||||
wait_for_smtp_port_in_container mail
|
||||
# sending test mails
|
||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-spam.txt"
|
||||
|
@ -460,18 +461,21 @@ EOF
|
|||
# Instead it tests the file-size (here 511) - which may differ with a different domain names
|
||||
# This test may be re-used as a global test to provide better test coverage.
|
||||
@test "checking opendkim: generator creates default keys size" {
|
||||
private_config="$(duplicate_config_for_container . mail_default_key_size)"
|
||||
# Prepare default key size 2048
|
||||
rm -rf "$(pwd)/test/config/keyDefault" && mkdir -p "$(pwd)/test/config/keyDefault"
|
||||
rm -rf "$private_config/keyDefault"
|
||||
mkdir -p "$private_config/keyDefault"
|
||||
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/keyDefault/":/tmp/docker-mailserver/ \
|
||||
-v "$(pwd)/test/config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
-v "$private_config/keyDefault/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$private_config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config | wc -l'
|
||||
assert_success
|
||||
assert_output 6
|
||||
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/keyDefault/opendkim":/etc/opendkim \
|
||||
-v "$private_config/keyDefault/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` \
|
||||
/bin/sh -c 'stat -c%s /etc/opendkim/keys/localhost.localdomain/mail.txt'
|
||||
|
||||
|
@ -483,18 +487,20 @@ EOF
|
|||
# Instead it tests the file-size (here 511) - which may differ with a different domain names
|
||||
# This test may be re-used as a global test to provide better test coverage.
|
||||
@test "checking opendkim: generator creates key size 2048" {
|
||||
private_config="$(duplicate_config_for_container . mail_key_size_2048)"
|
||||
# Prepare set key size 2048
|
||||
rm -rf "$(pwd)/test/config/key2048" && mkdir -p "$(pwd)/test/config/key2048"
|
||||
rm -rf "$private_config/key2048"
|
||||
mkdir -p "$private_config/config/key2048"
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/key2048/":/tmp/docker-mailserver/ \
|
||||
-v "$(pwd)/test/config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
-v "$private_config/key2048/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$private_config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config 2048 | wc -l'
|
||||
assert_success
|
||||
assert_output 6
|
||||
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/key2048/opendkim":/etc/opendkim \
|
||||
-v "$private_config/key2048/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` \
|
||||
/bin/sh -c 'stat -c%s /etc/opendkim/keys/localhost.localdomain/mail.txt'
|
||||
|
||||
|
@ -506,18 +512,20 @@ EOF
|
|||
# Instead it tests the file-size (here 329) - which may differ with a different domain names
|
||||
# This test may be re-used as a global test to provide better test coverage.
|
||||
@test "checking opendkim: generator creates key size 1024" {
|
||||
private_config="$(duplicate_config_for_container . mail_key_size_1024)"
|
||||
# Prepare set key size 1024
|
||||
rm -rf "$(pwd)/test/config/key1024" && mkdir -p "$(pwd)/test/config/key1024"
|
||||
rm -rf "$private_config/key1024"
|
||||
mkdir -p "$private_config/key1024"
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/key1024/":/tmp/docker-mailserver/ \
|
||||
-v "$(pwd)/test/config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
-v "$private_config/key1024/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$private_config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config 1024 | wc -l'
|
||||
assert_success
|
||||
assert_output 6
|
||||
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/key1024/opendkim":/etc/opendkim \
|
||||
-v "$private_config/key1024/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` \
|
||||
/bin/sh -c 'stat -c%s /etc/opendkim/keys/localhost.localdomain/mail.txt'
|
||||
|
||||
|
@ -526,139 +534,146 @@ EOF
|
|||
}
|
||||
|
||||
@test "checking opendkim: generator creates keys, tables and TrustedHosts" {
|
||||
rm -rf "$(pwd)/test/config/empty" && mkdir -p "$(pwd)/test/config/empty"
|
||||
private_config="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts)"
|
||||
rm -rf "$private_config/empty"
|
||||
mkdir -p "$private_config/empty"
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/empty/":/tmp/docker-mailserver/ \
|
||||
-v "$(pwd)/test/config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
-v "$private_config/empty/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$private_config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config | wc -l'
|
||||
assert_success
|
||||
assert_output 6
|
||||
# Check keys for localhost.localdomain
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
||||
-v "$private_config/empty/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/localhost.localdomain/ | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check keys for otherdomain.tld
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
||||
-v "$private_config/empty/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/otherdomain.tld | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check presence of tables and TrustedHosts
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
||||
-v "$private_config/empty/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c "ls -1 /etc/opendkim | grep -E 'KeyTable|SigningTable|TrustedHosts|keys'|wc -l"
|
||||
assert_success
|
||||
assert_output 4
|
||||
}
|
||||
|
||||
@test "checking opendkim: generator creates keys, tables and TrustedHosts without postfix-accounts.cf" {
|
||||
rm -rf "$(pwd)/test/config/without-accounts" && mkdir -p "$(pwd)/test/config/without-accounts"
|
||||
private_config="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts_without_postfix_accounts.cf)"
|
||||
rm -rf "$private_config/without-accounts"
|
||||
mkdir -p "$private_config/without-accounts"
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-accounts/":/tmp/docker-mailserver/ \
|
||||
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
-v "$private_config/without-accounts/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config | wc -l'
|
||||
assert_success
|
||||
assert_output 5
|
||||
# Check keys for localhost.localdomain
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-accounts/opendkim":/etc/opendkim \
|
||||
-v "$private_config/without-accounts/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/localhost.localdomain/ | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check keys for otherdomain.tld
|
||||
# run docker run --rm \
|
||||
# -v "$(pwd)/test/config/without-accounts/opendkim":/etc/opendkim \
|
||||
# -v "$private_config/without-accounts/opendkim":/etc/opendkim \
|
||||
# `docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/otherdomain.tld | wc -l'
|
||||
# assert_success
|
||||
# [ "$output" -eq 0 ]
|
||||
# Check presence of tables and TrustedHosts
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-accounts/opendkim":/etc/opendkim \
|
||||
-v "$private_config/without-accounts/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c "ls -1 /etc/opendkim | grep -E 'KeyTable|SigningTable|TrustedHosts|keys'|wc -l"
|
||||
assert_success
|
||||
assert_output 4
|
||||
}
|
||||
|
||||
@test "checking opendkim: generator creates keys, tables and TrustedHosts without postfix-virtual.cf" {
|
||||
rm -rf "$(pwd)/test/config/without-virtual" && mkdir -p "$(pwd)/test/config/without-virtual"
|
||||
private_config="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts_without_postfix_virtual.cf)"
|
||||
rm -rf "$private_config/without-virtual"
|
||||
mkdir -p "$private_config/without-virtual"
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-virtual/":/tmp/docker-mailserver/ \
|
||||
-v "$(pwd)/test/config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$private_config/without-virtual/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config | wc -l'
|
||||
assert_success
|
||||
assert_output 5
|
||||
# Check keys for localhost.localdomain
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-virtual/opendkim":/etc/opendkim \
|
||||
-v "$private_config/without-virtual/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/localhost.localdomain/ | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check keys for otherdomain.tld
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-virtual/opendkim":/etc/opendkim \
|
||||
-v "$private_config/without-virtual/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/otherdomain.tld | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check presence of tables and TrustedHosts
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-virtual/opendkim":/etc/opendkim \
|
||||
-v "$private_config/without-virtual/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c "ls -1 /etc/opendkim | grep -E 'KeyTable|SigningTable|TrustedHosts|keys'|wc -l"
|
||||
assert_success
|
||||
assert_output 4
|
||||
}
|
||||
|
||||
@test "checking opendkim: generator creates keys, tables and TrustedHosts using domain name" {
|
||||
rm -rf "$(pwd)/test/config/with-domain" && mkdir -p "$(pwd)/test/config/with-domain"
|
||||
private_config="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts_without_postfix_virtual.cf)"
|
||||
rm -rf "$private_config/with-domain" && mkdir -p "$private_config/with-domain"
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/":/tmp/docker-mailserver/ \
|
||||
-v "$(pwd)/test/config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
-v "$private_config/with-domain/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/postfix-accounts.cf":/tmp/docker-mailserver/postfix-accounts.cf \
|
||||
-v "$private_config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config | wc -l'
|
||||
assert_success
|
||||
assert_output 6
|
||||
# Generate key using domain name
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/with-domain/":/tmp/docker-mailserver/ \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-domain testdomain.tld | wc -l'
|
||||
assert_success
|
||||
assert_output 1
|
||||
# Check keys for localhost.localdomain
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/opendkim":/etc/opendkim \
|
||||
-v "$private_config/with-domain/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/localhost.localdomain/ | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check keys for otherdomain.tld
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/opendkim":/etc/opendkim \
|
||||
-v "$private_config/with-domain/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/otherdomain.tld | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check keys for testdomain.tld
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/opendkim":/etc/opendkim \
|
||||
-v "$private_config/with-domain/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'ls -1 /etc/opendkim/keys/testdomain.tld | wc -l'
|
||||
assert_success
|
||||
assert_output 2
|
||||
# Check presence of tables and TrustedHosts
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/opendkim":/etc/opendkim \
|
||||
-v "$private_config/with-domain/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c "ls -1 /etc/opendkim | grep -E 'KeyTable|SigningTable|TrustedHosts|keys' | wc -l"
|
||||
assert_success
|
||||
assert_output 4
|
||||
# Check valid entries actually present in KeyTable
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/opendkim":/etc/opendkim \
|
||||
-v "$private_config/with-domain/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c \
|
||||
"egrep 'localhost.localdomain|otherdomain.tld|localdomain2.com|testdomain.tld' /etc/opendkim/KeyTable | wc -l"
|
||||
assert_success
|
||||
assert_output 4
|
||||
# Check valid entries actually present in SigningTable
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/with-domain/opendkim":/etc/opendkim \
|
||||
-v "$private_config/with-domain/opendkim":/etc/opendkim \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c \
|
||||
"egrep 'localhost.localdomain|otherdomain.tld|localdomain2.com|testdomain.tld' /etc/opendkim/SigningTable | wc -l"
|
||||
assert_success
|
||||
|
@ -915,19 +930,20 @@ EOF
|
|||
|
||||
@test "checking accounts: no error is generated when deleting a user if /tmp/docker-mailserver/postfix-accounts.cf is missing" {
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-accounts/":/tmp/docker-mailserver/ \
|
||||
-v "$(duplicate_config_for_container without-accounts/ without-accounts-deleting-user)":/tmp/docker-mailserver/ \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'delmailuser -y user3@domain.tld'
|
||||
assert_success
|
||||
[ -z "$output" ]
|
||||
}
|
||||
|
||||
@test "checking accounts: user3 should have been added to /tmp/docker-mailserver/postfix-accounts.cf even when that file does not exist" {
|
||||
private_config=$(duplicate_config_for_container without-accounts/ without-accounts_file_does_not_exist)
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-accounts/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/without-accounts/":/tmp/docker-mailserver/ \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'addmailuser user3@domain.tld mypassword'
|
||||
assert_success
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/without-accounts/":/tmp/docker-mailserver/ \
|
||||
-v "$private_config/without-accounts/":/tmp/docker-mailserver/ \
|
||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'grep user3@domain.tld -i /tmp/docker-mailserver/postfix-accounts.cf'
|
||||
assert_success
|
||||
[ ! -z "$output" ]
|
||||
|
|
Loading…
Reference in a new issue