make `.txt` suffix mandatory again

This commit is contained in:
georglauterbach 2024-01-04 18:25:26 +01:00
parent dd7010b44e
commit 31491bc3d1
No known key found for this signature in database
GPG Key ID: F367F7C43C118578
17 changed files with 39 additions and 39 deletions

View File

@ -48,7 +48,7 @@ function _send_email_unchecked() {
( '--port' ) PORT=${2:?--port given but no argument} ; shift 2 ;; ( '--port' ) PORT=${2:?--port given but no argument} ; shift 2 ;;
( '--data' ) ( '--data' )
ADDITIONAL_SWAKS_OPTIONS+=('--data') ADDITIONAL_SWAKS_OPTIONS+=('--data')
ADDITIONAL_SWAKS_OPTIONS+=("@/tmp/docker-mailserver-test/emails/${2:?--data given but no argument provided}.txt") ADDITIONAL_SWAKS_OPTIONS+=("@/tmp/docker-mailserver-test/emails/${2:?--data given but no argument provided}")
shift 2 shift 2
;; ;;
( * ) ADDITIONAL_SWAKS_OPTIONS+=("'${1}'") ; shift 1 ;; ( * ) ADDITIONAL_SWAKS_OPTIONS+=("'${1}'") ; shift 1 ;;

View File

@ -225,9 +225,9 @@ function teardown_file() { _default_teardown ; }
sleep 10 sleep 10
# send some big emails # send some big emails
_send_email --to 'quotauser@otherdomain.tld' --data 'quota-exceeded' _send_email --to 'quotauser@otherdomain.tld' --data 'quota-exceeded.txt'
_send_email --to 'quotauser@otherdomain.tld' --data 'quota-exceeded' _send_email --to 'quotauser@otherdomain.tld' --data 'quota-exceeded.txt'
_send_email --to 'quotauser@otherdomain.tld' --data 'quota-exceeded' _send_email --to 'quotauser@otherdomain.tld' --data 'quota-exceeded.txt'
# check for quota warn message existence # check for quota warn message existence
run _repeat_until_success_or_timeout 20 _exec_in_container grep -R 'Subject: quota warning' /var/mail/otherdomain.tld/quotauser/new/ run _repeat_until_success_or_timeout 20 _exec_in_container grep -R 'Subject: quota warning' /var/mail/otherdomain.tld/quotauser/new/
assert_success assert_success

View File

@ -26,9 +26,9 @@ function setup_file() {
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container
# Single mail sent from 'spam@spam.com' that is handled by User (relocate) and Global (copy) sieves for user1: # Single mail sent from 'spam@spam.com' that is handled by User (relocate) and Global (copy) sieves for user1:
_send_email --data 'sieve/spam-folder' _send_email --data 'sieve/spam-folder.txt'
# Mail for user2 triggers the sieve-pipe: # Mail for user2 triggers the sieve-pipe:
_send_email --to 'user2@otherdomain.tld' --data 'sieve/pipe' _send_email --to 'user2@otherdomain.tld' --data 'sieve/pipe.txt'
_wait_for_empty_mail_queue_in_container _wait_for_empty_mail_queue_in_container
} }

View File

@ -26,7 +26,7 @@ function teardown() { _default_teardown ; }
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS' _common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container
_send_email --data 'existing/user1' _send_email --data 'existing/user1.txt'
_wait_for_empty_mail_queue_in_container _wait_for_empty_mail_queue_in_container
# Mail received should be stored as `u.1` (one file per message) # Mail received should be stored as `u.1` (one file per message)
@ -47,7 +47,7 @@ function teardown() { _default_teardown ; }
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS' _common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container
_send_email --data 'existing/user1' _send_email --data 'existing/user1.txt'
_wait_for_empty_mail_queue_in_container _wait_for_empty_mail_queue_in_container
# Mail received should be stored in `m.1` (1 or more messages) # Mail received should be stored in `m.1` (1 or more messages)

View File

@ -14,7 +14,7 @@ function setup_file() {
function teardown_file() { _default_teardown ; } function teardown_file() { _default_teardown ; }
@test 'normal delivery works' { @test 'normal delivery works' {
_send_email --data 'existing/user1' _send_email --data 'existing/user1.txt'
_count_files_in_directory_in_container /var/mail/localhost.localdomain/user1/new 1 _count_files_in_directory_in_container /var/mail/localhost.localdomain/user1/new 1
} }

View File

@ -25,7 +25,7 @@ function setup_file() {
_wait_for_service postfix _wait_for_service postfix
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container
_send_email --from 'virus@external.tld' --data 'amavis/virus' _send_email --from 'virus@external.tld' --data 'amavis/virus.txt'
_wait_for_empty_mail_queue_in_container _wait_for_empty_mail_queue_in_container
} }

View File

@ -18,7 +18,7 @@ function setup_file() {
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS' _common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container
_send_email --data 'existing/user1' _send_email --data 'existing/user1.txt'
_wait_for_empty_mail_queue_in_container _wait_for_empty_mail_queue_in_container
} }

View File

@ -51,7 +51,7 @@ function teardown_file() { _default_teardown ; }
_reload_postfix _reload_postfix
# Send test mail (it should fail to deliver): # Send test mail (it should fail to deliver):
_send_email_unchecked --from 'user@external.tld' --port 25 --data 'postgrey' _send_email_unchecked --from 'user@external.tld' --port 25 --data 'postgrey.txt'
assert_failure assert_failure
assert_output --partial 'Recipient address rejected: Delayed by Postgrey' assert_output --partial 'Recipient address rejected: Delayed by Postgrey'
@ -67,7 +67,7 @@ function teardown_file() { _default_teardown ; }
# Wait until `$POSTGREY_DELAY` seconds pass before trying again: # Wait until `$POSTGREY_DELAY` seconds pass before trying again:
sleep 3 sleep 3
# Retry delivering test mail (it should be trusted this time): # Retry delivering test mail (it should be trusted this time):
_send_email --from 'user@external.tld' --port 25 --data 'postgrey' _send_email --from 'user@external.tld' --port 25 --data 'postgrey.txt'
# Confirm postgrey permitted delivery (triplet is now trusted): # Confirm postgrey permitted delivery (triplet is now trusted):
_should_have_log_entry \ _should_have_log_entry \

View File

@ -57,8 +57,8 @@ function teardown_file() {
# Configure `send_email()` to send from the mail client container (CONTAINER2_NAME) via ENV override, # Configure `send_email()` to send from the mail client container (CONTAINER2_NAME) via ENV override,
# mail is sent to the DMS server container (CONTAINER1_NAME) via `--server` parameter: # mail is sent to the DMS server container (CONTAINER1_NAME) via `--server` parameter:
# TODO: Use _send_email_and_get_id when proper resolution of domain names is possible: # TODO: Use _send_email_and_get_id when proper resolution of domain names is possible:
CONTAINER_NAME=${CONTAINER2_NAME} _send_email_unchecked --server "${CONTAINER1_IP}" --port 25 --data 'postscreen' CONTAINER_NAME=${CONTAINER2_NAME} _send_email_unchecked --server "${CONTAINER1_IP}" --port 25 --data 'postscreen.txt'
# CONTAINER_NAME=${CONTAINER2_NAME} _send_email_and_get_id MAIL_ID_POSTSCREEN --server "${CONTAINER1_IP}" --data 'postscreen' # CONTAINER_NAME=${CONTAINER2_NAME} _send_email_and_get_id MAIL_ID_POSTSCREEN --server "${CONTAINER1_IP}" --data 'postscreen.txt'
# _print_mail_log_for_id "${MAIL_ID_POSTSCREEN}" # _print_mail_log_for_id "${MAIL_ID_POSTSCREEN}"
# assert_output --partial "stored mail into mailbox 'INBOX'" # assert_output --partial "stored mail into mailbox 'INBOX'"

View File

@ -95,7 +95,7 @@ function teardown() { _default_teardown ; }
function _should_send_spam_message() { function _should_send_spam_message() {
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container
_wait_for_tcp_port_in_container 10024 # port 10024 is for Amavis _wait_for_tcp_port_in_container 10024 # port 10024 is for Amavis
_send_email --from 'spam@external.tld' --data 'amavis/spam' _send_email --from 'spam@external.tld' --data 'amavis/spam.txt'
} }
function _should_be_received_by_amavis() { function _should_be_received_by_amavis() {

View File

@ -207,7 +207,7 @@ function _should_have_correct_mail_headers() {
# (eg: OVERRIDE_HOSTNAME or `--hostname mail --domainname example.test`) # (eg: OVERRIDE_HOSTNAME or `--hostname mail --domainname example.test`)
local EXPECTED_HOSTNAME=${3:-${EXPECTED_FQDN}} local EXPECTED_HOSTNAME=${3:-${EXPECTED_FQDN}}
_send_email --from 'user@external.tld' --data 'existing/user1' _send_email --from 'user@external.tld' --data 'existing/user1.txt'
_wait_for_empty_mail_queue_in_container _wait_for_empty_mail_queue_in_container
_count_files_in_directory_in_container '/var/mail/localhost.localdomain/user1/new/' '1' _count_files_in_directory_in_container '/var/mail/localhost.localdomain/user1/new/' '1'

View File

@ -38,7 +38,7 @@ function teardown_file() { _default_teardown ; }
@test "delivers mail to existing account" { @test "delivers mail to existing account" {
_wait_for_smtp_port_in_container _wait_for_smtp_port_in_container
_send_email --data 'existing/user1' # send a test email _send_email --data 'existing/user1.txt' # send a test email
# Verify delivery was successful, log line should look similar to: # Verify delivery was successful, log line should look similar to:
# postfix/lmtp[1274]: 0EA424ABE7D9: to=<user1@localhost.localdomain>, relay=127.0.0.1[127.0.0.1]:24, delay=0.13, delays=0.07/0.01/0.01/0.05, dsn=2.0.0, status=sent (250 2.0.0 <user1@localhost.localdomain> ixPpB+Zvv2P7BAAAUi6ngw Saved) # postfix/lmtp[1274]: 0EA424ABE7D9: to=<user1@localhost.localdomain>, relay=127.0.0.1[127.0.0.1]:24, delay=0.13, delays=0.07/0.01/0.01/0.05, dsn=2.0.0, status=sent (250 2.0.0 <user1@localhost.localdomain> ixPpB+Zvv2P7BAAAUi6ngw Saved)

View File

@ -29,7 +29,7 @@ function teardown_file() { _default_teardown ; }
--port 587 -tls --auth PLAIN \ --port 587 -tls --auth PLAIN \
--auth-user user1@localhost.localdomain \ --auth-user user1@localhost.localdomain \
--auth-password mypassword \ --auth-password mypassword \
--data 'privacy' --data 'privacy.txt'
_run_until_success_or_timeout 120 _exec_in_container_bash '[[ -d /var/mail/localhost.localdomain/user1/new ]]' _run_until_success_or_timeout 120 _exec_in_container_bash '[[ -d /var/mail/localhost.localdomain/user1/new ]]'
assert_success assert_success

View File

@ -63,34 +63,34 @@ function setup_file() {
# TODO: Move to clamav tests (For use when ClamAV is enabled): # TODO: Move to clamav tests (For use when ClamAV is enabled):
# _repeat_in_container_until_success_or_timeout 60 "${CONTAINER_NAME}" test -e /var/run/clamav/clamd.ctl # _repeat_in_container_until_success_or_timeout 60 "${CONTAINER_NAME}" test -e /var/run/clamav/clamd.ctl
# _send_email --from 'virus@external.tld' --data 'amavis/virus' # _send_email --from 'virus@external.tld' --data 'amavis/virus.txt'
# Required for 'delivers mail to existing alias': # Required for 'delivers mail to existing alias':
_send_email --to alias1@localhost.localdomain --data 'existing/alias-external' _send_email --to alias1@localhost.localdomain --data 'existing/alias-external.txt'
# Required for 'delivers mail to existing alias with recipient delimiter': # Required for 'delivers mail to existing alias with recipient delimiter':
_send_email --to alias1~test@localhost.localdomain --data 'existing/alias-recipient-delimiter' _send_email --to alias1~test@localhost.localdomain --data 'existing/alias-recipient-delimiter.txt'
# Required for 'delivers mail to existing catchall': # Required for 'delivers mail to existing catchall':
_send_email --to wildcard@localdomain2.com --data 'existing/catchall-local' _send_email --to wildcard@localdomain2.com --data 'existing/catchall-local.txt'
# Required for 'delivers mail to regexp alias': # Required for 'delivers mail to regexp alias':
_send_email --to test123@localhost.localdomain --data 'existing/regexp-alias-local' _send_email --to test123@localhost.localdomain --data 'existing/regexp-alias-local.txt'
# Required for 'rejects mail to unknown user': # Required for 'rejects mail to unknown user':
_send_email_unchecked --to nouser@localhost.localdomain --data 'non-existing-user' _send_email_unchecked --to nouser@localhost.localdomain --data 'non-existing-user.txt'
assert_failure assert_failure
# Required for 'redirects mail to external aliases': # Required for 'redirects mail to external aliases':
_send_email --to bounce-always@localhost.localdomain --data 'existing/regexp-alias-external' _send_email --to bounce-always@localhost.localdomain --data 'existing/regexp-alias-external.txt'
_send_email --to alias2@localhost.localdomain --data 'existing/alias-local' _send_email --to alias2@localhost.localdomain --data 'existing/alias-local.txt'
# Required for 'rejects spam': # Required for 'rejects spam':
_send_email --from 'spam@external.tld' --data 'amavis/spam' _send_email --from 'spam@external.tld' --data 'amavis/spam.txt'
# Required for 'delivers mail to existing account': # Required for 'delivers mail to existing account':
_send_email --data 'existing/user1' _send_email --data 'existing/user1.txt'
_send_email --to user2@otherdomain.tld _send_email --to user2@otherdomain.tld
_send_email --to user3@localhost.localdomain _send_email --to user3@localhost.localdomain
_send_email --to added@localhost.localdomain --data 'existing/added' _send_email --to added@localhost.localdomain --data 'existing/added.txt'
_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.txt'
_send_email --data 'sieve/spam-folder' _send_email --data 'sieve/spam-folder.txt'
_send_email --to user2@otherdomain.tld --data 'sieve/pipe' _send_email --to user2@otherdomain.tld --data 'sieve/pipe.txt'
_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 assert_success
} }

View File

@ -332,7 +332,7 @@ function teardown() {
--auth-password secret \ --auth-password secret \
--ehlo mail \ --ehlo mail \
--from ldap@localhost.localdomain \ --from ldap@localhost.localdomain \
--data 'auth/ldap-smtp-auth-spoofed' --data 'auth/ldap-smtp-auth-spoofed.txt'
assert_failure assert_failure
assert_output --partial 'Sender address rejected: not owned by user' assert_output --partial 'Sender address rejected: not owned by user'
} }
@ -345,7 +345,7 @@ function teardown() {
--ehlo mail \ --ehlo mail \
--from postmaster@localhost.localdomain \ --from postmaster@localhost.localdomain \
--to some.user@localhost.localdomain \ --to some.user@localhost.localdomain \
--data 'auth/ldap-smtp-auth-spoofed-alias' --data 'auth/ldap-smtp-auth-spoofed-alias.txt'
assert_output --partial 'End data with' assert_output --partial 'End data with'
} }
@ -361,7 +361,7 @@ function teardown() {
--ehlo mail \ --ehlo mail \
--from randomspoofedaddress@localhost.localdomain \ --from randomspoofedaddress@localhost.localdomain \
--to some.user@localhost.localdomain \ --to some.user@localhost.localdomain \
--data 'auth/ldap-smtp-auth-spoofed-sender-with-filter-exception' --data 'auth/ldap-smtp-auth-spoofed-sender-with-filter-exception.txt'
assert_failure assert_failure
assert_output --partial 'Sender address rejected: not owned by user' assert_output --partial 'Sender address rejected: not owned by user'
} }

View File

@ -299,7 +299,7 @@ EOF
--auth-password mypassword \ --auth-password mypassword \
--ehlo mail \ --ehlo mail \
--from user2@localhost.localdomain \ --from user2@localhost.localdomain \
--data 'auth/added-smtp-auth-spoofed' --data 'auth/added-smtp-auth-spoofed.txt'
assert_output --partial 'Sender address rejected: not owned by user' assert_output --partial 'Sender address rejected: not owned by user'
} }
@ -315,7 +315,7 @@ EOF
--auth-password mypassword \ --auth-password mypassword \
--ehlo mail \ --ehlo mail \
--from alias1@localhost.localdomain \ --from alias1@localhost.localdomain \
--data 'auth/added-smtp-auth-spoofed-alias' --data 'auth/added-smtp-auth-spoofed-alias.txt'
assert_success assert_success
assert_output --partial 'End data with' assert_output --partial 'End data with'
} }

View File

@ -20,7 +20,7 @@ function setup_file() {
function teardown_file() { _default_teardown ; } function teardown_file() { _default_teardown ; }
@test 'should successfully deliver mail' { @test 'should successfully deliver mail' {
_send_email --data 'existing/user1' _send_email --data 'existing/user1.txt'
_wait_for_empty_mail_queue_in_container _wait_for_empty_mail_queue_in_container
# Should be successfully sent (received) by Postfix: # Should be successfully sent (received) by Postfix: