mostly `pwd` replacements and introduction of local keywords

This commit is contained in:
Georg Lauterbach 2020-10-19 13:13:42 +02:00
parent 0d219800ff
commit 3f5c518950
No known key found for this signature in database
GPG Key ID: 386D76E7AD496709
32 changed files with 80 additions and 80 deletions

View File

@ -3,7 +3,7 @@ load 'test_helper/common'
function setup() {
docker run -d --name mail_with_default_relay \
-v "$(duplicate_config_for_container relay-hosts)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e DEFAULT_RELAY_HOST=default.relay.host.invalid:25 \
--cap-add=SYS_PTRACE \
-e PERMIT_DOCKER=host \
@ -23,4 +23,4 @@ function teardown() {
@test "checking default relay host: default relay host is added to main.cf" {
run docker exec mail_with_default_relay /bin/sh -c 'grep -e "^relayhost =" /etc/postfix/main.cf'
assert_output 'relayhost = default.relay.host.invalid:25'
}
}

View File

@ -23,7 +23,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_default_dhparams_one_dir \
-v "$(duplicate_config_for_container . mail_default_dhparams_both_one_dir)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e DMS_DEBUG=0 \
-e ONE_DIR=1 \
-h mail.my-domain.com -t ${NAME}
@ -31,7 +31,7 @@ function setup_file() {
docker run -d --name mail_default_dhparams_not_one_dir \
-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 \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e DMS_DEBUG=0 \
-e ONE_DIR=0 \
-h mail.my-domain.com -t ${NAME}

View File

@ -13,21 +13,21 @@ load 'test_helper/common'
function setup() {
run_setup_file_if_necessary
run_setup_file_if_necessary
}
function teardown() {
run_teardown_file_if_necessary
run_teardown_file_if_necessary
}
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" "${PRIVATE_CONFIG}/dhparams.pem"
local PRIVATE_CONFIG=$(duplicate_config_for_container .)
# copy the custom DHE params in local config
cp "$(pwd)/test/test-files/ssl/custom-dhe-params.pem" "${PRIVATE_CONFIG}/dhparams.pem"
docker run -d --name mail_manual_dhparams_not_one_dir \
docker run -d --name mail_manual_dhparams_not_one_dir \
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e DMS_DEBUG=0 \
-e ONE_DIR=0 \
-h mail.my-domain.com -t ${NAME}
@ -35,7 +35,7 @@ function setup_file() {
}
function teardown_file() {
docker rm -f mail_manual_dhparams_not_one_dir
docker rm -f mail_manual_dhparams_not_one_dir
}
@test "first" {

View File

@ -22,8 +22,8 @@ function teardown() {
function setup_file() {
docker run -d --name mail_manual_dhparams_one_dir \
-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 \
-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 \
-e ONE_DIR=1 \
-h mail.my-domain.com -t ${NAME}

View File

@ -11,7 +11,7 @@ teardown() {
setup_file() {
docker run --rm -d --name mail_disabled_clamav_spamassassin \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_CLAMAV=0 \
-e ENABLE_SPAMASSASSIN=0 \
-e DMS_DEBUG=0 \

View File

@ -11,7 +11,7 @@ function teardown() {
function setup_file() {
docker run --rm -d --name mail_fail2ban \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_FAIL2BAN=1 \
-e POSTSCREEN_ACTION=ignore \
--cap-add=NET_ADMIN \
@ -25,7 +25,7 @@ function setup_file() {
tail -f /var/log/faillog
wait_for_finished_setup_in_container mail_fail2ban
}
function teardown_file() {
@ -146,4 +146,4 @@ function teardown_file() {
@test "last" {
skip 'this test is only there to reliably mark the end for the teardown_file'
}
}

View File

@ -11,7 +11,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_fetchmail \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_FETCHMAIL=1 \
--cap-add=NET_ADMIN \
-e DMS_DEBUG=0 \
@ -61,4 +61,4 @@ function teardown_file() {
@test "last" {
skip 'this test is only there to reliably mark the end for the teardown_file'
}
}

View File

@ -12,7 +12,7 @@ setup_file() {
docker run -d --name mail_lmtp_ip \
-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 \
-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 \
-e DMS_DEBUG=0 \

View File

@ -7,7 +7,7 @@ function setup() {
function setup_file() {
docker run --rm -d --name mail_override_hostname \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \
-e ENABLE_SRS=1 \
@ -15,7 +15,7 @@ function setup_file() {
-h unknown.domain.tld \
-t ${NAME}
wait_for_smtp_port_in_container mail_override_hostname
wait_for_smtp_port_in_container mail_override_hostname
# postfix virtual transport lmtp
docker exec mail_override_hostname /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
}

View File

@ -11,7 +11,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_pop3 \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_POP3=1 \
-e DMS_DEBUG=0 \
-h mail.my-domain.com -t ${NAME}
@ -91,4 +91,4 @@ function teardown_file() {
@test "last" {
skip 'this test is only there to reliably mark the end for the teardown_file'
}
}

View File

@ -16,14 +16,14 @@ function teardown() {
function setup_file() {
docker run -d --name mail_postfix_inet_default \
-v "$(duplicate_config_for_container . mail_postfix_inet_default)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-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 "$(duplicate_config_for_container . mail_postfix_inet_all)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e POSTFIX_INET_PROTOCOLS=all \
-h mail.my-domain.com -t "${NAME}"
@ -31,7 +31,7 @@ function setup_file() {
docker run -d --name mail_postfix_inet_ipv4 \
-v "$(duplicate_config_for_container . mail_postfix_inet_ipv4)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e POSTFIX_INET_PROTOCOLS=ipv4 \
-h mail.my-domain.com -t "${NAME}"
@ -39,7 +39,7 @@ function setup_file() {
docker run -d --name mail_postfix_inet_ipv6 \
-v "$(duplicate_config_for_container . mail_postfix_inet_ipv6)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e POSTFIX_INET_PROTOCOLS=ipv6 \
-h mail.my-domain.com -t "${NAME}"

View File

@ -14,7 +14,7 @@ teardown() {
setup_file() {
docker run -d --name mail_postscreen \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e POSTSCREEN_ACTION=enforce \
--cap-add=NET_ADMIN \
-h mail.my-domain.com -t ${NAME}
@ -59,4 +59,4 @@ teardown_file() {
@test "last" {
skip 'only used to call teardown_file from teardown'
}
}

View File

@ -11,7 +11,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_privacy \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e SASL_PASSWD="external-domain.com username:password" \
-e ENABLE_MANAGESIEVE=1 \
--cap-add=SYS_PTRACE \

View File

@ -16,7 +16,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_no_quotas \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e DMS_DEBUG=0 \
-e ENABLE_QUOTAS=0 \
-h mail.my-domain.com -t "${NAME}"

View File

@ -11,7 +11,7 @@ function teardown() {
function setup_file() {
docker run --rm -d --name mail_smtponly \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e SMTP_ONLY=1 \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \

View File

@ -16,7 +16,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_spam_bounced_defined \
-v "$(duplicate_config_for_container . mail_spam_bounced_defined)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_SPAMASSASSIN=1 \
-e SPAMASSASSIN_SPAM_TO_INBOX=0 \
-h mail.my-domain.com -t "${NAME}"
@ -25,7 +25,7 @@ function setup_file() {
docker run -d --name mail_spam_bounced_undefined \
-v "$(duplicate_config_for_container . mail_spam_bounced_defined)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_SPAMASSASSIN=1 \
-h mail.my-domain.com -t "${NAME}"

View File

@ -16,7 +16,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_spam_moved_junk \
-v "$(duplicate_config_for_container . mail_spam_moved_junk)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_SPAMASSASSIN=1 \
-e SPAMASSASSIN_SPAM_TO_INBOX=1 \
-e MOVE_SPAM_TO_JUNK=1 \
@ -27,7 +27,7 @@ function setup_file() {
docker run -d --name mail_spam_moved_new \
-v "$(duplicate_config_for_container . mail_spam_moved_new)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_SPAMASSASSIN=1 \
-e SPAMASSASSIN_SPAM_TO_INBOX=1 \
-e MOVE_SPAM_TO_JUNK=0 \

View File

@ -11,7 +11,7 @@ teardown() {
setup_file() {
docker run -d --name mail_special_use_folders \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e SASL_PASSWD="external-domain.com username:password" \
-e ENABLE_CLAMAV=0 \
-e ENABLE_SPAMASSASSIN=0 \

View File

@ -3,7 +3,7 @@ load 'test_helper/common'
@test "checking SRS: SRS_DOMAINNAME is used correctly" {
docker run --rm -d --name mail_srs_domainname \
-v "$(duplicate_config_for_container . mail_srs_domainname)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \
-e ENABLE_SRS=1 \
@ -20,7 +20,7 @@ load 'test_helper/common'
@test "checking SRS: DOMAINNAME is handled correctly" {
docker run --rm -d --name mail_domainname \
-v "$(duplicate_config_for_container . mail_domainname)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \
-e ENABLE_SRS=1 \
@ -31,4 +31,4 @@ load 'test_helper/common'
teardown() { docker rm -f mail_domainname; }
repeat_until_success_or_timeout 15 docker exec mail_domainname grep "SRS_DOMAIN=my-domain.com" /etc/default/postsrsd
}
}

View File

@ -9,10 +9,12 @@ function teardown() {
}
function setup_file() {
local PRIVATE_CONFIG
PRIVATE_CONFIG="$(duplicate_config_for_container . mail_lets_domain)"
docker run -d --name mail_lets_domain \
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-v "${PRIVATE_CONFIG}/letsencrypt/my-domain.com":/etc/letsencrypt/live/my-domain.com \
-e DMS_DEBUG=0 \
-e SSL_TYPE=letsencrypt \
@ -22,7 +24,7 @@ function setup_file() {
PRIVATE_CONFIG="$(duplicate_config_for_container . mail_lets_hostname)"
docker run -d --name mail_lets_hostname \
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-v "${PRIVATE_CONFIG}/letsencrypt/mail.my-domain.com":/etc/letsencrypt/live/mail.my-domain.com \
-e DMS_DEBUG=0 \
-e SSL_TYPE=letsencrypt \
@ -34,7 +36,7 @@ function setup_file() {
docker run -d --name mail_lets_acme_json \
-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 \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e DMS_DEBUG=0 \
-e SSL_TYPE=letsencrypt \
-e "SSL_DOMAIN=*.example.com" \

View File

@ -11,7 +11,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_manual_ssl \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-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 \
-e SSL_KEY_PATH=/tmp/docker-mailserver/letsencrypt/mail.my-domain.com/privkey.pem \
@ -57,4 +57,4 @@ function teardown_file() {
@test "last" {
skip 'this test is only there to reliably mark the end for the teardown_file'
}
}

View File

@ -3,14 +3,14 @@ load 'test_helper/common'
function setup() {
docker run -d --name mail_undef_spam_subject \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-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 "$(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 \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/onedir":/var/mail-state \
-e ENABLE_CLAMAV=1 \
-e SPOOF_PROTECTION=1 \
-e ENABLE_SPAMASSASSIN=1 \
@ -47,4 +47,4 @@ function teardown() {
assert_success
run docker exec mail_undef_spam_subject /bin/sh -c "grep '\$sa_spam_subject_tag' /etc/amavis/conf.d/20-debian_defaults | grep '= undef'"
assert_success
}
}

View File

@ -12,7 +12,7 @@ teardown() {
setup_file() {
docker run -d --name mail_with_imap \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_SASLAUTHD=1 \
-e SASLAUTHD_MECHANISMS=rimap \
-e SASLAUTHD_MECH_OPTIONS=127.0.0.1 \

View File

@ -15,11 +15,11 @@ function setup_file() {
docker run -d --name ldap_for_mail \
-e LDAP_DOMAIN="localhost.localdomain" \
-h ldap.my-domain.com -t ldap
-h ldap.my-domain.com -t ldap
docker run -d --name mail_with_ldap \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_LDAP=1 \
-e LDAP_SERVER_HOST=ldap \
-e LDAP_START_TLS=no \
@ -214,7 +214,7 @@ function teardown_file() {
# Pflogsumm delivery check
#
@test "checking pflogsum delivery" {
@test "checking pflogsum delivery" {
# checking default sender is correctly set when env variable not defined
run docker exec mail_with_ldap grep "mailserver-report@mail.my-domain.com" /etc/logrotate.d/maillog
assert_success

View File

@ -11,7 +11,7 @@ teardown() {
setup_file() {
docker run -d --name mail_with_mdbox_format \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e SASL_PASSWD="external-domain.com username:password" \
-e ENABLE_CLAMAV=0 \
-e ENABLE_SPAMASSASSIN=0 \

View File

@ -11,7 +11,7 @@ function teardown() {
function setup_file() {
docker run -d --name mail_with_postgrey \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_POSTGREY=1 \
-e POSTGREY_DELAY=15 \
-e POSTGREY_MAX_AGE=35 \
@ -98,4 +98,4 @@ function teardown_file() {
@test "last" {
# this test is only there to reliably mark the end for the teardown_file
}
}

View File

@ -3,7 +3,7 @@ load 'test_helper/common'
function setup() {
CONTAINER=$(docker run -d \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e DMS_DEBUG=0 \
-h mail.my-domain.com -t ${NAME})
# using postfix availability as start indicator, this might be insufficient for postgrey
@ -17,4 +17,4 @@ function teardown() {
@test "checking process: postgrey (disabled in default configuration)" {
run docker exec $CONTAINER /bin/bash -c "ps aux --forest | grep -v grep | grep 'postgrey'"
assert_failure
}
}

View File

@ -16,7 +16,7 @@ function setup_file() {
docker run -d --name mail_with_relays \
-v "$tmp_confdir":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e RELAY_HOST=default.relay.com \
-e RELAY_PORT=2525 \
-e RELAY_USER=smtp_user \

View File

@ -11,7 +11,7 @@ teardown() {
setup_file() {
docker run -d --name mail_with_sdbox_format \
-v "$(duplicate_config_for_container .)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e SASL_PASSWD="external-domain.com username:password" \
-e ENABLE_CLAMAV=0 \
-e ENABLE_SPAMASSASSIN=0 \

View File

@ -9,7 +9,7 @@ setup() {
# 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 "$(duplicate_config_for_container . mail_smtponly_second_network)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e SMTP_ONLY=1 \
-e PERMIT_DOCKER=connected-networks \
-e DMS_DEBUG=0 \
@ -20,7 +20,7 @@ setup() {
docker start mail_smtponly_second_network
docker run -d --name mail_smtponly_second_network_sender \
-v "$(duplicate_config_for_container . mail_smtponly_second_network_sender)":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e SMTP_ONLY=1 \
-e PERMIT_DOCKER=connected-networks \
-e DMS_DEBUG=0 \
@ -56,4 +56,4 @@ teardown() {
repeat_until_success_or_timeout 60 run docker exec mail_smtponly_second_network /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
[ "$status" -ge 0 ]
}
}

View File

@ -75,7 +75,7 @@ function container_is_running() {
# @param ${1} port
# @param ${2} container name
function wait_for_tcp_port_in_container() {
repeat_until_success_or_timeout --fatal-test "container_is_running ${2}" "${TEST_TIMEOUT_IN_SECONDS}" docker exec "${2}" /bin/sh -c "nc -z 0.0.0.0 ${1}"
repeat_until_success_or_timeout --fatal-test "container_is_running ${2}" "${TEST_TIMEOUT_IN_SECONDS}" docker exec ${2} /bin/sh -c "nc -z 0.0.0.0 ${1}"
}
# @param ${1} name of the postfix container
@ -177,8 +177,6 @@ function wait_for_service() {
function wait_for_changes_to_be_detected_in_container() {
local CONTAINER_NAME="${1}"
local TIMEOUT=${TEST_TIMEOUT_IN_SECONDS}
repeat_in_container_until_success_or_timeout \
"${TIMEOUT}" \
"${CONTAINER_NAME}" \
bash -c 'source /usr/local/bin/helper_functions.sh; cmp --silent -- <(_monitored_files_checksums) "${CHKSUM_FILE}" >/dev/null'
repeat_in_container_until_success_or_timeout "${TIMEOUT}" "${CONTAINER_NAME}" \
bash -c 'source /usr/local/bin/helper_functions.sh; cmp --silent -- <(_monitored_files_checksums) "${CHKSUM_FILE}" >/dev/null'
}

View File

@ -10,7 +10,7 @@ setup() {
}
setup_file() {
PRIVATE_CONFIG="$(duplicate_config_for_container . mail)"
local PRIVATE_CONFIG="$(duplicate_config_for_container . mail)"
mv "${PRIVATE_CONFIG}/user-patches/user-patches.sh" "${PRIVATE_CONFIG}/user-patches.sh"
docker run --rm -d --name mail \
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
@ -460,7 +460,7 @@ 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)"
local PRIVATE_CONFIG="$(duplicate_config_for_container . mail_default_key_size)"
# Prepare default key size 2048
rm -rf "${PRIVATE_CONFIG}/keyDefault"
mkdir -p "${PRIVATE_CONFIG}/keyDefault"
@ -486,7 +486,7 @@ 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)"
local PRIVATE_CONFIG="$(duplicate_config_for_container . mail_key_size_2048)"
# Prepare set key size 2048
rm -rf "${PRIVATE_CONFIG}/key2048"
mkdir -p "${PRIVATE_CONFIG}/config/key2048"
@ -511,7 +511,7 @@ 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)"
local PRIVATE_CONFIG="$(duplicate_config_for_container . mail_key_size_1024)"
# Prepare set key size 1024
rm -rf "${PRIVATE_CONFIG}/key1024"
mkdir -p "${PRIVATE_CONFIG}/key1024"
@ -533,7 +533,7 @@ EOF
}
@test "checking opendkim: generator creates keys, tables and TrustedHosts" {
PRIVATE_CONFIG="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts)"
local 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 \
@ -564,7 +564,7 @@ EOF
}
@test "checking opendkim: generator creates keys, tables and TrustedHosts without postfix-accounts.cf" {
PRIVATE_CONFIG="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts_without_postfix_accounts.cf)"
local 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 \
@ -594,7 +594,7 @@ EOF
}
@test "checking opendkim: generator creates keys, tables and TrustedHosts without postfix-virtual.cf" {
PRIVATE_CONFIG="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts_without_postfix_virtual.cf)"
local 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 \
@ -624,7 +624,7 @@ EOF
}
@test "checking opendkim: generator creates keys, tables and TrustedHosts using domain name" {
PRIVATE_CONFIG="$(duplicate_config_for_container . mail_dkim_generator_creates_keys_tables_TrustedHosts_without_postfix_virtual.cf)"
local 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 "${PRIVATE_CONFIG}/with-domain/":/tmp/docker-mailserver/ \
@ -932,7 +932,7 @@ EOF
}
@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)
local PRIVATE_CONFIG=$(duplicate_config_for_container without-accounts/ without-accounts_file_does_not_exist)
run docker run --rm \
-v "${PRIVATE_CONFIG}/without-accounts/":/tmp/docker-mailserver/ \
"${IMAGE_NAME:?}" /bin/sh -c 'addmailuser user3@domain.tld mypassword'