diff --git a/Makefile b/Makefile index 4c58adaf..fb9f2da5 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 7b7aa1c3..8881ab42 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -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 diff --git a/test/tests.bats b/test/tests.bats index 34a498cd..6c97bd28 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -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 #