diff --git a/Makefile b/Makefile index 2444c9f5..8218f356 100644 --- a/Makefile +++ b/Makefile @@ -188,16 +188,6 @@ run: --link ldap_for_mail:ldap \ -h mail.my-domain.com -t $(NAME) sleep 15 - docker run -d --name mail_with_imap \ - -v "`pwd`/test/config":/tmp/docker-mailserver \ - -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ - -e ENABLE_SASLAUTHD=1 \ - -e SASLAUTHD_MECHANISMS=rimap \ - -e SASLAUTHD_MECH_OPTIONS=127.0.0.1 \ - -e POSTMASTER_ADDRESS=postmaster@localhost.localdomain \ - -e DMS_DEBUG=0 \ - -h mail.my-domain.com -t $(NAME) - sleep 15 generate-accounts-after-run: docker run --rm -e MAIL_USER=added@localhost.localdomain -e MAIL_PASS=mypassword -t $(NAME) /bin/sh -c 'echo "$$MAIL_USER|$$(doveadm pw -s SHA512-CRYPT -u $$MAIL_USER -p $$MAIL_PASS)"' >> test/config/postfix-accounts.cf @@ -264,7 +254,6 @@ clean: mail_manual_ssl \ ldap_for_mail \ mail_with_ldap \ - mail_with_imap \ mail_override_hostname \ mail_domainname \ mail_srs_domainname diff --git a/test/mail_with_imap.bats b/test/mail_with_imap.bats new file mode 100644 index 00000000..ae867c5f --- /dev/null +++ b/test/mail_with_imap.bats @@ -0,0 +1,56 @@ + +load 'test_helper/common' + +setup() { + run_setup_file_if_necessary +} + +teardown() { + run_teardown_file_if_necessary +} + +setup_file() { + docker run -d --name mail_with_imap \ + -v "`pwd`/test/config":/tmp/docker-mailserver \ + -v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \ + -e ENABLE_SASLAUTHD=1 \ + -e SASLAUTHD_MECHANISMS=rimap \ + -e SASLAUTHD_MECH_OPTIONS=127.0.0.1 \ + -e POSTMASTER_ADDRESS=postmaster@localhost.localdomain \ + -e DMS_DEBUG=0 \ + -h mail.my-domain.com -t ${NAME} + wait_for_smtp_port_in_container mail_with_imap +} + +teardown_file() { + docker rm -f mail_with_imap +} + +@test "first" { + skip 'only used to call setup_file from setup' +} + +# +# RIMAP +# + +# dovecot +@test "checking dovecot: ldap rimap connection and authentication works" { + run docker exec mail_with_imap /bin/sh -c "nc -w 1 0.0.0.0 143 < /tmp/docker-mailserver-test/auth/imap-auth.txt" + assert_success +} + +# saslauthd +@test "checking saslauthd: sasl rimap authentication works" { + run docker exec mail_with_imap bash -c "testsaslauthd -u user1@localhost.localdomain -p mypassword" + assert_success +} + +@test "checking saslauthd: rimap smtp authentication" { + run docker exec mail_with_imap /bin/sh -c "nc -w 5 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/smtp-auth-login.txt | grep 'Authentication successful'" + assert_success +} + +@test "last" { + skip 'only used to call teardown_file from teardown' +} diff --git a/test/tests.bats b/test/tests.bats index 66f2030e..54ee1acb 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -1530,28 +1530,6 @@ function count_processed_changes() { assert_success } - -# -# RIMAP -# - -# dovecot -@test "checking dovecot: ldap rimap connection and authentication works" { - run docker exec mail_with_imap /bin/sh -c "nc -w 1 0.0.0.0 143 < /tmp/docker-mailserver-test/auth/imap-auth.txt" - assert_success -} - -# saslauthd -@test "checking saslauthd: sasl rimap authentication works" { - run docker exec mail_with_imap bash -c "testsaslauthd -u user1@localhost.localdomain -p mypassword" - assert_success -} - -@test "checking saslauthd: rimap smtp authentication" { - run docker exec mail_with_imap /bin/sh -c "nc -w 5 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/smtp-auth-login.txt | grep 'Authentication successful'" - assert_success -} - # # Pflogsumm delivery check #