mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Added test on catchall
This commit is contained in:
parent
354c396068
commit
c813e6a4b3
1
Makefile
1
Makefile
|
@ -65,6 +65,7 @@ fixtures:
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user-and-cc-local-alias.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user-and-cc-local-alias.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-regexp-alias-external.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-regexp-alias-external.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-regexp-alias-local.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-regexp-alias-local.txt"
|
||||||
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-catchall-local.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/sieve-spam-folder.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/sieve-spam-folder.txt"
|
||||||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/non-existing-user.txt"
|
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/non-existing-user.txt"
|
||||||
# Wait for mails to be analyzed
|
# Wait for mails to be analyzed
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
alias1@localhost.localdomain user1@localhost.localdomain
|
alias1@localhost.localdomain user1@localhost.localdomain
|
||||||
alias2@localhost.localdomain external1@otherdomain.tld
|
alias2@localhost.localdomain external1@otherdomain.tld
|
||||||
|
@localdomain2.com user1@localhost.localdomain
|
||||||
|
|
12
test/email-templates/existing-catchall-local.txt
Normal file
12
test/email-templates/existing-catchall-local.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
HELO mail.external.tld
|
||||||
|
MAIL FROM: user@external.tld
|
||||||
|
RCPT TO: wildcard@localdomain2.com
|
||||||
|
DATA
|
||||||
|
From: Docker Mail Server <dockermailserver@external.tld>
|
||||||
|
To: Existing Local User <wildcard@localdomain2.com>
|
||||||
|
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||||
|
Subject: Test Message
|
||||||
|
This is a test mail.
|
||||||
|
|
||||||
|
.
|
||||||
|
QUIT
|
|
@ -131,7 +131,7 @@
|
||||||
@test "checking smtp: delivers mail to existing account" {
|
@test "checking smtp: delivers mail to existing account" {
|
||||||
run docker exec mail /bin/sh -c "grep 'status=sent (delivered via dovecot service)' /var/log/mail/mail.log | wc -l"
|
run docker exec mail /bin/sh -c "grep 'status=sent (delivered via dovecot service)' /var/log/mail/mail.log | wc -l"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" -eq 5 ]
|
[ "$output" -eq 6 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking smtp: delivers mail to existing alias" {
|
@test "checking smtp: delivers mail to existing alias" {
|
||||||
|
@ -140,16 +140,22 @@
|
||||||
[ "$output" = 1 ]
|
[ "$output" = 1 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "checking smtp: delivers mail to existing catchall" {
|
||||||
|
run docker exec mail /bin/sh -c "grep 'to=<user1@localhost.localdomain>, orig_to=<wildcard@localdomain2.com>' /var/log/mail/mail.log | grep 'status=sent' | wc -l"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[ "$output" = 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "checking smtp: delivers mail to regexp alias" {
|
@test "checking smtp: delivers mail to regexp alias" {
|
||||||
run docker exec mail /bin/sh -c "grep 'to=<user1@localhost.localdomain>, orig_to=<test123@localhost.localdomain>' /var/log/mail/mail.log | grep 'status=sent' | wc -l"
|
run docker exec mail /bin/sh -c "grep 'to=<user1@localhost.localdomain>, orig_to=<test123@localhost.localdomain>' /var/log/mail/mail.log | grep 'status=sent' | wc -l"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = 1 ]
|
[ "$output" = 1 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking smtp: user1 should have received 3 mails" {
|
@test "checking smtp: user1 should have received 5 mails" {
|
||||||
run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/new | wc -l"
|
run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/new | wc -l"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = 4 ]
|
[ "$output" = 5 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking smtp: rejects mail to unknown user" {
|
@test "checking smtp: rejects mail to unknown user" {
|
||||||
|
@ -206,8 +212,9 @@
|
||||||
@test "checking postfix: vhost file is correct" {
|
@test "checking postfix: vhost file is correct" {
|
||||||
run docker exec mail cat /etc/postfix/vhost
|
run docker exec mail cat /etc/postfix/vhost
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "${lines[0]}" = "localhost.localdomain" ]
|
[ "${lines[0]}" = "localdomain2.com" ]
|
||||||
[ "${lines[1]}" = "otherdomain.tld" ]
|
[ "${lines[1]}" = "localhost.localdomain" ]
|
||||||
|
[ "${lines[2]}" = "otherdomain.tld" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking postfix: main.cf overrides" {
|
@test "checking postfix: main.cf overrides" {
|
||||||
|
@ -275,7 +282,7 @@
|
||||||
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
-v "$(pwd)/test/config/postfix-virtual.cf":/tmp/docker-mailserver/postfix-virtual.cf \
|
||||||
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config | wc -l'
|
`docker inspect --format '{{ .Config.Image }}' mail` /bin/sh -c 'generate-dkim-config | wc -l'
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" -eq 5 ]
|
[ "$output" -eq 6 ]
|
||||||
# Check keys for localhost.localdomain
|
# Check keys for localhost.localdomain
|
||||||
run docker run --rm \
|
run docker run --rm \
|
||||||
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
||||||
|
|
Loading…
Reference in a new issue