mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
2527ebfaf2
add postfix service quota check check-for-changes on quotas setquota command fix checkforchanges quota addquota verify user exists add setquota in setup.sh merging addquota into setquota test quota commands add ldap tests for dovecot quota fix smtp only quota postfix rules test postfix conf add quota test integration add quota exceeded test add wait analyze fix tests fix setup typo add test fixes fix error output wip update startup rules fix setup fix setup tests fix output commands remove quota on remove user try to fix sync limit mails check if file exists fix path change used quota user fix post size check if quota file exists update tests configure virtualmailbox limit for dovecot last fix fix quota expr relax dovecot tests auto create dovecot-quotas fix dovecot apply quota test wip quota warning trying to fix get dovadm quota dovecot applies fix fix quota warning lda path test count mail on quota fix quota warning permissiosn fix test
84 lines
2.2 KiB
Bash
84 lines
2.2 KiB
Bash
load 'test_helper/common'
|
|
|
|
function setup() {
|
|
run_setup_file_if_necessary
|
|
}
|
|
|
|
function teardown() {
|
|
run_teardown_file_if_necessary
|
|
}
|
|
|
|
function setup_file() {
|
|
docker run --rm -d --name mail_smtponly \
|
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
|
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
|
-e SMTP_ONLY=1 \
|
|
-e PERMIT_DOCKER=network \
|
|
-e DMS_DEBUG=0 \
|
|
-e OVERRIDE_HOSTNAME=mail.my-domain.com \
|
|
-t ${NAME}
|
|
|
|
wait_for_finished_setup_in_container mail_smtponly
|
|
}
|
|
|
|
function teardown_file() {
|
|
docker rm -f mail_smtponly
|
|
}
|
|
|
|
@test "first" {
|
|
skip 'this test must come first to reliably identify when to run setup_file'
|
|
}
|
|
|
|
#
|
|
# configuration checks
|
|
#
|
|
|
|
@test "checking configuration: hostname/domainname override" {
|
|
run docker exec mail_smtponly /bin/bash -c "cat /etc/mailname | grep my-domain.com"
|
|
assert_success
|
|
}
|
|
|
|
#
|
|
# imap
|
|
#
|
|
|
|
@test "checking process: dovecot imaplogin (disabled using SMTP_ONLY)" {
|
|
run docker exec mail_smtponly /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/dovecot'"
|
|
assert_failure
|
|
}
|
|
|
|
@test "checking configuration: dovecot quota absent in postconf (disabled using SMTP_ONLY)" {
|
|
run docker exec mail_smtponly /bin/bash -c "postconf | grep 'check_policy_service inet:localhost:65265'"
|
|
assert_failure
|
|
}
|
|
|
|
#
|
|
# smtp
|
|
#
|
|
|
|
@test "checking smtp_only: mail send should work" {
|
|
run docker exec mail_smtponly /bin/sh -c "postconf -e smtp_host_lookup=no"
|
|
assert_success
|
|
run docker exec mail_smtponly /bin/sh -c "/etc/init.d/postfix reload"
|
|
assert_success
|
|
run docker exec mail_smtponly /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/smtp-only.txt"
|
|
assert_success
|
|
run docker exec mail_smtponly /bin/sh -c 'grep -cE "to=<user2\@external.tld>.*status\=sent" /var/log/mail/mail.log'
|
|
[ "$status" -ge 0 ]
|
|
}
|
|
|
|
#
|
|
# PERMIT_DOCKER=network
|
|
#
|
|
|
|
@test "checking PERMIT_DOCKER=network: opendmarc/opendkim config" {
|
|
run docker exec mail_smtponly /bin/sh -c "cat /etc/opendmarc/ignore.hosts | grep '172.16.0.0/12'"
|
|
assert_success
|
|
run docker exec mail_smtponly /bin/sh -c "cat /etc/opendkim/TrustedHosts | grep '172.16.0.0/12'"
|
|
assert_success
|
|
}
|
|
|
|
@test "last" {
|
|
skip 'this test is only there to reliably mark the end for the teardown_file'
|
|
}
|