diff --git a/test/ENABLE_POP3_0.bats b/test/ENABLE_POP3_0.bats new file mode 100644 index 00000000..30229bd1 --- /dev/null +++ b/test/ENABLE_POP3_0.bats @@ -0,0 +1,9 @@ +@test "checking process: process is not running" { + run docker exec mail /bin/bash -c "ps aux | grep 'dovecot/pop'" + [ "$status" -eq 1 ] +} + +@test "checking pop: server does not respond on port 110" { + run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110" + [ "$status" -eq 1 ] +} diff --git a/test/ENABLE_POP3_1.bats b/test/ENABLE_POP3_1.bats new file mode 100644 index 00000000..ccf13b0b --- /dev/null +++ b/test/ENABLE_POP3_1.bats @@ -0,0 +1,14 @@ +@test "checking process: process is running" { + run docker exec mail /bin/bash -c "ps aux | grep 'dovecot/pop'" + [ "$status" -eq 0 ] +} + +@test "checking pop: server responds on port 110" { + run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110 | grep '+OK'" + [ "$status" -eq 0 ] +} + +@test "checking pop: authentication works" { + run docker exec mail /bin/sh -c "nc -w 1 0.0.0.0 110 < /tmp/docker-mailserver-test/auth/pop3-auth.txt" + [ "$status" -eq 0 ] +} diff --git a/test/SASL_PASSWD_0.bats b/test/SASL_PASSWD_0.bats new file mode 100644 index 00000000..10c2971e --- /dev/null +++ b/test/SASL_PASSWD_0.bats @@ -0,0 +1,4 @@ +@test "checking sasl: sasl_passwd.db should not exist" { + run docker exec mail [ -f /etc/postfix/sasl_passwd.db ] + [ "$status" -eq 1 ] +} diff --git a/test/SASL_PASSWD_1.bats b/test/SASL_PASSWD_1.bats new file mode 100644 index 00000000..7c472850 --- /dev/null +++ b/test/SASL_PASSWD_1.bats @@ -0,0 +1,14 @@ +@test "checking sasl: doveadm auth test works with good password" { + run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld mypassword | grep 'auth succeeded'" + [ "$status" -eq 0 ] +} + +@test "checking sasl: doveadm auth test fails with bad password" { + run docker exec mail /bin/sh -c "doveadm auth test -x service=smtp user2@otherdomain.tld BADPASSWORD | grep 'auth failed'" + [ "$status" -eq 0 ] +} + +@test "checking sasl: sasl_passwd.db exists" { + run docker exec mail [ -f /etc/postfix/sasl_passwd.db ] + [ "$status" -eq 0 ] +}