diff --git a/Makefile b/Makefile index fb9f2da5..c8bd2498 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,12 @@ run: -v "`pwd`/test":/tmp/docker-mailserver-test \ -e DISABLE_SPAMASSASSIN=1 \ -h mail.my-domain.com -t $(NAME) + sleep 20 + docker run -d --name mail_disabled_clamav \ + -v "`pwd`/test/config":/tmp/docker-mailserver \ + -v "`pwd`/test":/tmp/docker-mailserver-test \ + -e DISABLE_CLAMAV=1 \ + -h mail.my-domain.com -t $(NAME) # Wait for containers to fully start sleep 20 @@ -89,4 +95,4 @@ tests: clean: # Remove running test containers - docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis mail_disabled_spamassassin + docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis mail_disabled_spamassassin mail_disabled_clamav diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 8881ab42..037332f9 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -326,10 +326,12 @@ if [ -f /tmp/docker-mailserver/dovecot.cf ]; then fi # Start services related to SMTP -/etc/init.d/clamav-daemon start if ! [ "$DISABLE_SPAMASSASSIN" = 1 ]; then /etc/init.d/spamassassin start fi +if ! [ "$DISABLE_CLAMAV" = 1 ]; then + /etc/init.d/clamav-daemon start +fi if ! [ "$DISABLE_AMAVIS" = 1 ]; then /etc/init.d/amavis start fi diff --git a/test/tests.bats b/test/tests.bats index 6c97bd28..f19a8542 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -47,6 +47,11 @@ [ "$status" -eq 1 ] } +@test "checking process: clamav (clamav disabled by DISABLE_CLAMAV)" { + run docker exec mail_disabled_clamav /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/clamd'" + [ "$status" -eq 1 ] +} + # # imap #