ci: refactored sedfile & used _send_mail where possible (#3103)

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
Georg Lauterbach 2023-02-22 10:26:04 +01:00 committed by GitHub
parent 853301338c
commit 35692a9111
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 55 additions and 76 deletions

View file

@ -26,9 +26,9 @@ function setup_file() {
_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:
_run_in_container_bash "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/sieve-spam-folder.txt"
_send_email 'sieve-spam-folder'
# Mail for user2 triggers the sieve-pipe:
_run_in_container_bash "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/sieve-pipe.txt"
_send_email 'sieve-pipe'
_wait_for_empty_mail_queue_in_container
}

View file

@ -13,14 +13,12 @@ function setup_file() {
function teardown_file() { _default_teardown ; }
@test "normal delivery works" {
_run_in_container_bash "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
assert_success
@test 'normal delivery works' {
_send_email 'existing-user1'
_count_files_in_directory_in_container /var/mail/localhost.localdomain/user1/new 1
}
@test "(IMAP) special-use folders should not exist yet" {
@test '(IMAP) special-use folders should not exist yet' {
_should_have_content_in_directory '/var/mail/localhost.localdomain/user1'
refute_line '.Drafts'
refute_line '.Sent'

View file

@ -25,10 +25,7 @@ function setup_file() {
_wait_for_service postfix
_wait_for_smtp_port_in_container
_run_in_container_bash "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-virus.txt"
assert_success
_send_email 'amavis-virus'
_wait_for_empty_mail_queue_in_container
}

View file

@ -17,8 +17,7 @@ function setup_file() {
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
_wait_for_smtp_port_in_container
_run_in_container_bash "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
assert_success
_send_email 'existing-user1'
_wait_for_empty_mail_queue_in_container
}

View file

@ -71,11 +71,8 @@ function teardown() { _default_teardown ; }
function _should_send_spam_message() {
_wait_for_smtp_port_in_container
# Port 10024 (Amavis)
_wait_for_tcp_port_in_container 10024
_run_in_container_bash "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/amavis-spam.txt"
assert_success
_wait_for_tcp_port_in_container 10024 # port 10024 is for Amavis
_send_email 'amavis-spam'
}
function _should_be_received_by_amavis() {