From ad99e1126e951b6e5f60df9575345b290057fbce Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Tue, 16 Aug 2016 19:15:28 +0200 Subject: [PATCH] Refactored. --- test/ENABLE_POP3.bats | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/ENABLE_POP3.bats diff --git a/test/ENABLE_POP3.bats b/test/ENABLE_POP3.bats new file mode 100644 index 00000000..0e0337f8 --- /dev/null +++ b/test/ENABLE_POP3.bats @@ -0,0 +1,30 @@ +if [ "$ENABLE_POP3" = 1 ]; then + + @test "checking pop: 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 ] + } + +else #################################################################################################### + + @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 ] + } + +fi