From bec2b0ac1dc0a1c45a3c187449c89147a14a2277 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Tue, 16 Aug 2016 18:07:09 +0200 Subject: [PATCH] Refactored. --- Makefile | 4 ++-- test/ENABLE_POP3.bats | 18 ------------------ test/SASL_PASSWD.bats | 29 ----------------------------- 3 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 test/ENABLE_POP3.bats delete mode 100644 test/SASL_PASSWD.bats diff --git a/Makefile b/Makefile index 23f0c52a..39ea1771 100644 --- a/Makefile +++ b/Makefile @@ -57,11 +57,11 @@ tests: # Start tests ifdef ENABLE_POP3 @echo "ENABLE_POP3 => $(ENABLE_POP3)" - ./test/bats/bats test/ENABLE_POP3.bats + ./test/bats/bats test/ENABLE_POP3_$(ENABLE_POP3).bats endif ifdef SASL_PASSWD @echo "SASL_PASSWD => $(SASL_PASSWD)" - ./test/bats/bats test/SASL_PASSWD.bats + ./test/bats/bats test/SASL_PASSWD_$(SASL_PASSWD_).bats endif clean: diff --git a/test/ENABLE_POP3.bats b/test/ENABLE_POP3.bats deleted file mode 100644 index 1cc08fb4..00000000 --- a/test/ENABLE_POP3.bats +++ /dev/null @@ -1,18 +0,0 @@ -@test "checking pop: ENABLE_POP3=1 => server is running" { - if [ "$ENABLE_POP3" != 1 ]; then - skip - fi - - run docker exec mail /bin/bash -c "nc -w 1 0.0.0.0 110 | grep '+OK'" - [ "$status" -eq 0 ] - } - - -@test "checking pop: ENABLE_POP3=1 => authentication works" { - if [ "$ENABLE_POP3" != 1 ]; then - skip - fi - - 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.bats b/test/SASL_PASSWD.bats deleted file mode 100644 index e01cc2f0..00000000 --- a/test/SASL_PASSWD.bats +++ /dev/null @@ -1,29 +0,0 @@ -@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'" - - if [ -n "$SASL_PASSWD" ]; then - [ "$status" -eq 0 ] - else - [ "$status" -eq 1 ] - fi -} - -@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'" - - if [ -n "$SASL_PASSWD" ]; then - [ "$status" -eq 0 ] - else - [ "$status" -eq 1 ] - fi -} - -@test "checking sasl: sasl_passwd.db exists" { - run docker exec mail [ -f /etc/postfix/sasl_passwd.db ] - - if [ -n "$SASL_PASSWD" ]; then - [ "$status" -eq 0 ] - else - [ "$status" -eq 1 ] - fi -}