added additional asserts

This commit is contained in:
georglauterbach 2024-01-02 00:35:31 +01:00
parent 5212bd4668
commit aa0a16b4c9
No known key found for this signature in database
GPG Key ID: F367F7C43C118578
5 changed files with 19 additions and 0 deletions

View File

@ -84,13 +84,21 @@ function setup_file() {
# Required for 'delivers mail to existing account': # Required for 'delivers mail to existing account':
_send_email --data 'existing/user1' _send_email --data 'existing/user1'
assert_success
_send_email --to user2@otherdomain.tld --data 'existing/user2' _send_email --to user2@otherdomain.tld --data 'existing/user2'
assert_success
_send_email --to user3@localhost.localdomain --data 'existing/user3' _send_email --to user3@localhost.localdomain --data 'existing/user3'
assert_success
_send_email --to added@localhost.localdomain --data 'existing/added' _send_email --to added@localhost.localdomain --data 'existing/added'
assert_success
_send_email --to user1@localhost.localdomain --data 'existing/user-and-cc-local-alias' _send_email --to user1@localhost.localdomain --data 'existing/user-and-cc-local-alias'
assert_success
_send_email --data 'sieve/spam-folder' _send_email --data 'sieve/spam-folder'
assert_success
_send_email --to user2@otherdomain.tld --data 'sieve/pipe' _send_email --to user2@otherdomain.tld --data 'sieve/pipe'
assert_success
_run_in_container_bash 'sendmail root < /tmp/docker-mailserver-test/emails/sendmail/root-email.txt' _run_in_container_bash 'sendmail root < /tmp/docker-mailserver-test/emails/sendmail/root-email.txt'
assert_success
} }
@test "should succeed at emptying mail queue" { @test "should succeed at emptying mail queue" {

View File

@ -25,10 +25,12 @@ function teardown_file() { _default_teardown ; }
@test 'authentication works' { @test 'authentication works' {
_send_email 'auth/pop3-auth' '-w 1 0.0.0.0 110' _send_email 'auth/pop3-auth' '-w 1 0.0.0.0 110'
assert_success
} }
@test 'added user authentication works' { @test 'added user authentication works' {
_send_email 'auth/added-pop3-auth' '-w 1 0.0.0.0 110' _send_email 'auth/added-pop3-auth' '-w 1 0.0.0.0 110'
assert_success
} }
@test '/var/log/mail/mail.log is error-free' { @test '/var/log/mail/mail.log is error-free' {

View File

@ -22,6 +22,7 @@ function teardown_file() { _default_teardown ; }
@test '(Dovecot) LDAP RIMAP connection and authentication works' { @test '(Dovecot) LDAP RIMAP connection and authentication works' {
_send_email 'auth/imap-auth' '-w 1 0.0.0.0 143' _send_email 'auth/imap-auth' '-w 1 0.0.0.0 143'
assert_success
} }
@test '(SASLauthd) SASL RIMAP authentication works' { @test '(SASLauthd) SASL RIMAP authentication works' {
@ -32,11 +33,14 @@ function teardown_file() { _default_teardown ; }
@test '(SASLauthd) RIMAP SMTP authentication works' { @test '(SASLauthd) RIMAP SMTP authentication works' {
_nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 25' _nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 25'
assert_output --partial 'Error: authentication not enabled' assert_output --partial 'Error: authentication not enabled'
assert_failure
_nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 465' _nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 465'
assert_success
assert_output --partial 'Authentication successful' assert_output --partial 'Authentication successful'
_nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 587' _nc_wrapper 'auth/smtp-auth-login.txt' '-w 5 0.0.0.0 587'
assert_success
assert_output --partial 'Authentication successful' assert_output --partial 'Authentication successful'
} }

View File

@ -370,13 +370,16 @@ function teardown() {
# Requires ENV `PERMIT_DOCKER=container` # Requires ENV `PERMIT_DOCKER=container`
_nc_wrapper 'auth/sasl-ldap-smtp-auth.txt' '-w 5 0.0.0.0 25' _nc_wrapper 'auth/sasl-ldap-smtp-auth.txt' '-w 5 0.0.0.0 25'
assert_output --partial 'Error: authentication not enabled' assert_output --partial 'Error: authentication not enabled'
assert_failure
# do not use _send_email here # do not use _send_email here
_run_in_container_bash 'openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt' _run_in_container_bash 'openssl s_client -quiet -connect 0.0.0.0:465 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt'
assert_success
assert_output --partial 'Authentication successful' assert_output --partial 'Authentication successful'
# do not use _send_email here # do not use _send_email here
_run_in_container_bash 'openssl s_client -quiet -starttls smtp -connect 0.0.0.0:587 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt' _run_in_container_bash 'openssl s_client -quiet -starttls smtp -connect 0.0.0.0:587 < /tmp/docker-mailserver-test/auth/sasl-ldap-smtp-auth.txt'
assert_success
assert_output --partial 'Authentication successful' assert_output --partial 'Authentication successful'
} }

View File

@ -81,10 +81,12 @@ function teardown_file() { _default_teardown ; }
@test "imap: authentication works" { @test "imap: authentication works" {
_send_email 'auth/imap-auth' '-w 1 0.0.0.0 143' _send_email 'auth/imap-auth' '-w 1 0.0.0.0 143'
assert_success
} }
@test "imap: added user authentication works" { @test "imap: added user authentication works" {
_send_email 'auth/added-imap-auth' '-w 1 0.0.0.0 143' _send_email 'auth/added-imap-auth' '-w 1 0.0.0.0 143'
assert_success
} }
# #