mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Fixed tests for #143
This commit is contained in:
parent
f5f6637233
commit
bc7b42e4bc
6
Makefile
6
Makefile
|
@ -1,5 +1,4 @@
|
|||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
NAME = tvial/docker-mailserver:$(BRANCH)
|
||||
NAME = tvial/docker-mailserver:testing
|
||||
|
||||
all: build-no-cache run fixtures tests clean
|
||||
all-fast: build run fixtures tests clean
|
||||
|
@ -51,7 +50,7 @@ fixtures:
|
|||
docker exec mail /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/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
|
||||
sleep 10
|
||||
sleep 20
|
||||
|
||||
tests:
|
||||
# Start tests
|
||||
|
@ -60,4 +59,3 @@ tests:
|
|||
clean:
|
||||
# Remove running test containers
|
||||
docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer
|
||||
rm -rf "$(pwd)/test/config/empty" && mkdir -p "$(pwd)/test/config/empty"
|
||||
|
|
|
@ -255,28 +255,27 @@
|
|||
-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 \
|
||||
tvial/docker-mailserver:v2 /bin/sh -c 'generate-dkim-config | wc -l'
|
||||
tvial/docker-mailserver:testing /bin/sh -c 'generate-dkim-config | wc -l'
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" -eq 5 ]
|
||||
# Check keys for localhost.localdomain
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
||||
tvial/docker-mailserver:v2 /bin/sh -c 'ls -1 /etc/opendkim/keys/localhost.localdomain/ | wc -l'
|
||||
tvial/docker-mailserver:testing /bin/sh -c 'ls -1 /etc/opendkim/keys/localhost.localdomain/ | wc -l'
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" -eq 2 ]
|
||||
# Check keys for otherdomain.tld
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
||||
tvial/docker-mailserver:v2 /bin/sh -c 'ls -1 /etc/opendkim/keys/otherdomain.tld | wc -l'
|
||||
tvial/docker-mailserver:testing /bin/sh -c 'ls -1 /etc/opendkim/keys/otherdomain.tld | wc -l'
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" -eq 2 ]
|
||||
# Check presence of tables and TrustedHosts
|
||||
run docker run --rm \
|
||||
-v "$(pwd)/test/config/empty/opendkim":/etc/opendkim \
|
||||
tvial/docker-mailserver:v2 /bin/sh -c "ls -1 etc/opendkim | grep -E 'KeyTable|SigningTable|TrustedHosts|keys'|wc -l"
|
||||
tvial/docker-mailserver:testing /bin/sh -c "ls -1 etc/opendkim | grep -E 'KeyTable|SigningTable|TrustedHosts|keys'|wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" -eq 4 ]
|
||||
rm -rf "$(pwd)/test/config/empty" && mkdir -p "$(pwd)/test/config/empty"
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -333,7 +332,7 @@
|
|||
# Getting mail_fail2ban container IP
|
||||
MAIL_FAIL2BAN_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' mail_fail2ban)
|
||||
# Create a container which will send wront authentications and should banned
|
||||
docker run --name fail-auth-mailer -e MAIL_FAIL2BAN_IP=$MAIL_FAIL2BAN_IP -v "$(pwd)/test":/tmp/docker-mailserver-test -d tvial/docker-mailserver:v2 tail -f /var/log/faillog
|
||||
docker run --name fail-auth-mailer -e MAIL_FAIL2BAN_IP=$MAIL_FAIL2BAN_IP -v "$(pwd)/test":/tmp/docker-mailserver-test -d tvial/docker-mailserver:testing tail -f /var/log/faillog
|
||||
docker exec fail-auth-mailer /bin/sh -c 'nc $MAIL_FAIL2BAN_IP 25 < /tmp/docker-mailserver-test/auth/smtp-auth-login-wrong.txt'
|
||||
docker exec fail-auth-mailer /bin/sh -c 'nc $MAIL_FAIL2BAN_IP 25 < /tmp/docker-mailserver-test/auth/smtp-auth-login-wrong.txt'
|
||||
docker exec fail-auth-mailer /bin/sh -c 'nc $MAIL_FAIL2BAN_IP 25 < /tmp/docker-mailserver-test/auth/smtp-auth-login-wrong.txt'
|
||||
|
|
Loading…
Reference in a new issue