Enable option to not run spamassassin

Setting the `DISABLE_SPAMASSASSIN=1` env var will start this container
without spamassain.
This commit is contained in:
Kyle Ondy 2016-08-04 13:07:24 -04:00
parent 3fd2f365a9
commit 60e5e42908
No known key found for this signature in database
GPG Key ID: 8D6B17000513440D
3 changed files with 15 additions and 2 deletions

View File

@ -54,6 +54,12 @@ run:
-v "`pwd`/test":/tmp/docker-mailserver-test \
-e DISABLE_AMAVIS=1 \
-h mail.my-domain.com -t $(NAME)
sleep 20
docker run -d --name mail_disabled_spamassassin \
-v "`pwd`/test/config":/tmp/docker-mailserver \
-v "`pwd`/test":/tmp/docker-mailserver-test \
-e DISABLE_SPAMASSASSIN=1 \
-h mail.my-domain.com -t $(NAME)
# Wait for containers to fully start
sleep 20
@ -83,4 +89,4 @@ tests:
clean:
# Remove running test containers
docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis
docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis mail_disabled_spamassassin

View File

@ -326,8 +326,10 @@ if [ -f /tmp/docker-mailserver/dovecot.cf ]; then
fi
# Start services related to SMTP
/etc/init.d/spamassassin start
/etc/init.d/clamav-daemon start
if ! [ "$DISABLE_SPAMASSASSIN" = 1 ]; then
/etc/init.d/spamassassin start
fi
if ! [ "$DISABLE_AMAVIS" = 1 ]; then
/etc/init.d/amavis start
fi

View File

@ -42,6 +42,11 @@
[ "$status" -eq 1 ]
}
@test "checking process: spamassassin (spamassassin disabled by DISABLE_SPAMASSASSIN)" {
run docker exec mail_disabled_spamassassin /bin/bash -c "ps aux --forest | grep -v grep | grep ''/usr/sbin/spamd'"
[ "$status" -eq 1 ]
}
#
# imap
#