From 6300ee451c06ceac570d41bf587ecf17118e7d6c Mon Sep 17 00:00:00 2001 From: Florian Lehne Date: Fri, 10 Feb 2017 14:26:54 +0100 Subject: [PATCH] Added missing tests --- test/tests.bats | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/tests.bats b/test/tests.bats index 2706da59..1cd3538d 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -14,6 +14,44 @@ load 'test_helper/bats-assert/load' assert_success } +@test "checking configuration: hostname/domainname override: check container hostname is applied correctly" { + run docker exec mail_override_hostname /bin/bash -c "hostname | grep unknown.domain.tld" + assert_success +} + +@test "checking configuration: hostname/domainname override: check overriden hostname is applied to all configs" { + run docker exec mail_override_hostname /bin/bash -c "cat /etc/mailname | grep my-domain.com" + assert_success + run docker exec mail_override_hostname /bin/bash -c "postconf -n | grep mydomain | grep my-domain.com" + assert_success + run docker exec mail_override_hostname /bin/bash -c "postconf -n | grep myhostname | grep mail.my-domain.com" + assert_success + run docker exec mail_override_hostname /bin/bash -c "doveconf | grep hostname | grep mail.my-domain.com" + assert_success + run docker exec mail_override_hostname /bin/bash -c "cat /etc/opendmarc.conf | grep AuthservID | grep mail.my-domain.com" + assert_success + run docker exec mail_override_hostname /bin/bash -c "cat /etc/opendmarc.conf | grep TrustedAuthservIDs | grep mail.my-domain.com" + assert_success + run docker exec mail_override_hostname /bin/bash -c "cat /etc/amavis/conf.d/05-node_id | grep myhostname | grep mail.my-domain.com" + assert_success +} + +@test "checking configuration: hostname/domainname override: check hostname in postfix HELO message" { + run docker exec mail_override_hostname /bin/bash -c "nc -w 1 0.0.0.0 25 | grep mail.my-domain.com" + assert_success +} + +@test "checking configuration: hostname/domainname override: check headers of received mail" { + run docker exec mail_override_hostname /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/new | wc -l | grep 1" + assert_success + run docker exec mail_override_hostname /bin/sh -c "cat /var/mail/localhost.localdomain/user1/new/* | grep mail.my-domain.com" + assert_success + + # test whether the container hostname is not found in received mail + run docker exec mail_override_hostname /bin/sh -c "cat /var/mail/localhost.localdomain/user1/new/* | grep unknown.domain.tld" + assert_failure +} + # # processes #