1
1
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-12-18 23:14:11 +01:00
docker-mailserver/test/tests/parallel/set3/mta/smtponly.bats
Georg Lauterbach 9e81517fe3
tests: Use swaks instead of nc for sending mail (#3732)
See associated `CHANGELOG.md` entry for details.

---------

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2024-01-03 13:17:54 +13:00

52 lines
1.5 KiB
Bash

load "${REPOSITORY_ROOT}/test/helper/common"
load "${REPOSITORY_ROOT}/test/helper/setup"
BATS_TEST_NAME_PREFIX='[SMTP-Only] '
CONTAINER_NAME='dms-test_env-smtp-only'
function setup_file() {
_init_with_defaults
local CUSTOM_SETUP_ARGUMENTS=(
--env SMTP_ONLY=1
--env PERMIT_DOCKER=network
)
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
_wait_for_smtp_port_in_container
}
function teardown_file() { _default_teardown ; }
@test "Dovecot quota absent in postconf" {
_run_in_container postconf
assert_success
refute_output --partial "check_policy_service inet:localhost:65265'"
}
# TODO: needs complete rework when proper DNS container is running for tests
@test "sending mail should work" {
skip 'TODO: This test is absolutely broken and needs reworking!'
assert_success
# it looks as if someone tries to send mail to another domain outside of DMS
_send_email \
--ehlo mail.origin.test \
--protocol SSMTPA \
--server mail.origin.test \
--from user@origin.test \
--to user@destination.test \
--auth PLAIN \
--auth-user user@origin.test \
--auth-password secret
assert_success
_wait_for_empty_mail_queue_in_container
# this seemingly succeeds, but looking at the logs, it doesn't
_run_in_container_bash 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
# this is absolutely useless! `grep -c` count 0 but also returns 0; the mail was never properly sent!
[[ ${status} -ge 0 ]]
}