1
1
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-11-08 10:49:17 +01:00

Extract SRS DOMAINNAME tests/container into own file

This commit is contained in:
Martin Schulze 2020-09-17 23:46:31 +02:00
parent d38ff4c122
commit ad0be553d8
3 changed files with 35 additions and 30 deletions

@ -71,27 +71,6 @@ run:
-h unknown.domain.tld \
-t $(NAME)
-@ sleep $(SLEEP)
docker run --rm -d --name mail_domainname \
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \
-e ENABLE_SRS=1 \
-e DOMAINNAME=my-domain.com \
-h unknown.domain.tld \
-t $(NAME)
-@ sleep $(SLEEP)
docker run --rm -d --name mail_srs_domainname \
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \
-e ENABLE_SRS=1 \
-e SRS_DOMAINNAME=srs.my-domain.com \
-e DOMAINNAME=my-domain.com \
-h unknown.domain.tld \
-t $(NAME)
-@ sleep $(SLEEP)
generate-accounts-after-run:
@ docker run --rm -e MAIL_USER=added@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf

@ -0,0 +1,34 @@
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 "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \
-e ENABLE_SRS=1 \
-e SRS_DOMAINNAME=srs.my-domain.com \
-e DOMAINNAME=my-domain.com \
-h unknown.domain.tld \
-t ${NAME}
teardown() { docker rm -f mail_srs_domainname; }
repeat_until_success_or_timeout 15 docker exec mail_srs_domainname grep "SRS_DOMAIN=srs.my-domain.com" /etc/default/postsrsd
}
@test "checking SRS: DOMAINNAME is handled correctly" {
docker run --rm -d --name mail_domainname \
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
-e PERMIT_DOCKER=network \
-e DMS_DEBUG=0 \
-e ENABLE_SRS=1 \
-e DOMAINNAME=my-domain.com \
-h unknown.domain.tld \
-t ${NAME}
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
}

@ -667,20 +667,12 @@ EOF
assert_success
}
@test "checking SRS: SRS_DOMAINNAME is used correctly" {
run docker exec mail_srs_domainname grep "SRS_DOMAIN=srs.my-domain.com" /etc/default/postsrsd
assert_success
}
@test "checking SRS: OVERRIDE_HOSTNAME is handled correctly" {
run docker exec mail_override_hostname grep "SRS_DOMAIN=my-domain.com" /etc/default/postsrsd
assert_success
}
@test "checking SRS: DOMAINNAME is handled correctly" {
run docker exec mail_domainname grep "SRS_DOMAIN=my-domain.com" /etc/default/postsrsd
assert_success
}
@test "checking SRS: fallback to hostname is handled correctly" {
run docker exec mail grep "SRS_DOMAIN=my-domain.com" /etc/default/postsrsd
assert_success