2015-10-18 19:02:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Set up test framework
|
2015-10-18 19:08:21 +00:00
|
|
|
wget -q https://raw.github.com/lehmannro/assert.sh/master/assert.sh
|
2015-10-18 19:02:46 +00:00
|
|
|
source assert.sh
|
|
|
|
|
2015-10-18 20:02:47 +00:00
|
|
|
# Testing that services are running
|
|
|
|
assert_raises "docker exec mail ps aux --forest | grep '/usr/lib/postfix/master'" "true"
|
|
|
|
assert_raises "docker exec mail ps aux --forest | grep '/usr/sbin/saslauthd'" "true"
|
|
|
|
assert_raises "docker exec mail ps aux --forest | grep '/usr/sbin/clamd'" "true"
|
|
|
|
assert_raises "docker exec mail ps aux --forest | grep '/usr/sbin/amavisd-new'" "true"
|
|
|
|
|
2015-10-18 19:02:46 +00:00
|
|
|
# Testing user creation
|
|
|
|
assert "docker exec mail ls -A /var/mail/localhost.localdomain/user1" "cur\nnew\ntmp"
|
|
|
|
assert "docker exec mail ls /var/mail/otherdomain.tld/user2" "cur\nnew\ntmp"
|
|
|
|
|
|
|
|
# Testing that mail is received for existing user
|
|
|
|
assert_raises "docker exec mail grep 'status=sent (delivered to maildir)' /var/log/mail.log" "false"
|
2015-10-18 19:30:53 +00:00
|
|
|
assert "docker exec mail ls -A /var/mail/localhost.localdomain/user1/new | wc -l" "1"
|
2015-10-18 19:02:46 +00:00
|
|
|
|
2015-10-18 20:02:47 +00:00
|
|
|
# Testing presence of freshclam CRON
|
|
|
|
assert "docker exec mail crontab -l" "0 1 * * * /usr/bin/freshclam --quiet"
|
|
|
|
|
2015-10-18 19:02:46 +00:00
|
|
|
# Ending tests
|
|
|
|
assert_end
|