mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
tests: remove legacy functions / tests (#2434)
This commit is contained in:
parent
4203afec3f
commit
6d1c740310
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -25,10 +17,6 @@ function teardown_file() {
|
|||
docker rm -f mail_helper_functions
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "check helper functions (network.sh): _sanitize_ipv4_to_subnet_cidr" {
|
||||
run docker exec mail_helper_functions bash -c "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 255.255.255.255/0"
|
||||
assert_output "0.0.0.0/0"
|
||||
|
@ -37,7 +25,3 @@ function teardown_file() {
|
|||
run docker exec mail_helper_functions bash -c "source /usr/local/bin/helpers/index.sh; _sanitize_ipv4_to_subnet_cidr 192.168.255.14/32"
|
||||
assert_output "192.168.255.14/32"
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -4,14 +4,6 @@ load 'test_helper/common'
|
|||
# use `supervisorctl tail -<num bytes> changedetector` instead to increase log output.
|
||||
# Default `<num bytes>` appears to be around 1500.
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container . mail_changedetector_one)"
|
||||
|
@ -36,11 +28,6 @@ function teardown_file() {
|
|||
docker rm -f mail_changedetector_two
|
||||
}
|
||||
|
||||
# this test must come first to reliably identify when to run setup_file
|
||||
@test "first" {
|
||||
skip 'Starting testing of changedetector'
|
||||
}
|
||||
|
||||
@test "checking changedetector: servers are ready" {
|
||||
wait_for_service mail_changedetector_one changedetector
|
||||
wait_for_service mail_changedetector_two changedetector
|
||||
|
@ -91,8 +78,3 @@ function teardown_file() {
|
|||
run docker exec mail_changedetector_one /bin/bash -c "supervisorctl tail -3000 changedetector"
|
||||
assert_output --partial "Removed stale lock"
|
||||
}
|
||||
|
||||
# this test is only there to reliably mark the end for the teardown_file
|
||||
@test "last" {
|
||||
skip 'Finished testing of changedetector'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -29,10 +21,6 @@ teardown_file() {
|
|||
docker rm -f mail_disabled_clamav_spamassassin
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'only used to call setup_file from setup'
|
||||
}
|
||||
|
||||
@test "checking process: clamav (clamav disabled by ENABLED_CLAMAV=0)" {
|
||||
run docker exec mail_disabled_clamav_spamassassin /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/clamd'"
|
||||
assert_failure
|
||||
|
@ -57,7 +45,3 @@ teardown_file() {
|
|||
run docker exec mail_disabled_clamav_spamassassin /bin/bash -c "pkill -f clamd && sleep 10 && ps aux --forest | grep -v grep | grep '/usr/sbin/clamd'"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -34,10 +26,6 @@ function teardown_file() {
|
|||
docker rm -f mail_fail2ban fail-auth-mailer
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
#
|
||||
# processes
|
||||
#
|
||||
|
@ -163,7 +151,3 @@ function teardown_file() {
|
|||
run docker exec mail_fail2ban /bin/bash -c "pkill fail2ban && sleep 10 && ps aux --forest | grep -v grep | grep '/usr/bin/python3 /usr/bin/fail2ban-server'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -25,10 +17,6 @@ function teardown_file() {
|
|||
docker rm -f mail_fetchmail
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
#
|
||||
# processes
|
||||
#
|
||||
|
@ -60,7 +48,3 @@ function teardown_file() {
|
|||
run docker exec mail_fetchmail /bin/bash -c "pkill fetchmail && sleep 10 && ps aux --forest | grep -v grep | grep '/usr/bin/fetchmail'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -26,10 +18,6 @@ function teardown_file() {
|
|||
docker rm -f mail_fetchmail_parallel
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
#
|
||||
# processes
|
||||
#
|
||||
|
@ -91,7 +79,3 @@ function teardown_file() {
|
|||
run docker exec mail_fetchmail_parallel /bin/bash -c "pkill fetchmail && sleep 10 && ps aux --forest | grep -v grep | grep '/usr/bin/fetchmail -f /etc/fetchmailrc.d/fetchmail-2.rc'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
|
@ -64,10 +61,6 @@ function setup_file() {
|
|||
docker exec mail_non_subdomain_hostname /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'only used to call setup_file from setup'
|
||||
}
|
||||
|
||||
@test "checking SRS: SRS_DOMAINNAME is used correctly" {
|
||||
repeat_until_success_or_timeout 15 docker exec mail_srs_domainname grep "SRS_DOMAIN=srs.my-domain.com" /etc/default/postsrsd
|
||||
}
|
||||
|
@ -196,7 +189,3 @@ function setup_file() {
|
|||
run docker stop -t 60 mail_domainname
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG PRIVATE_ETC
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -28,10 +20,6 @@ teardown_file() {
|
|||
docker rm -f mail_lmtp_ip
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'only used to call setup_file from setup'
|
||||
}
|
||||
|
||||
#
|
||||
# Postfix VIRTUAL_TRANSPORT
|
||||
#
|
||||
|
@ -53,7 +41,3 @@ teardown_file() {
|
|||
assert_success
|
||||
assert_output 1
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -25,10 +17,6 @@ function teardown_file() {
|
|||
docker rm -f mail_pop3
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
#
|
||||
# pop
|
||||
#
|
||||
|
@ -90,7 +78,3 @@ function teardown_file() {
|
|||
run docker exec mail_pop3 /bin/sh -c "postconf | grep '^mynetworks =' | egrep '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}/32'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
|
||||
# Getting mail container IP
|
||||
MAIL_POSTSCREEN_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' mail_postscreen)
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -33,10 +27,6 @@ teardown_file() {
|
|||
docker rm -f mail_postscreen mail_postscreen_sender
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'only used to call setup_file from setup'
|
||||
}
|
||||
|
||||
@test "checking postscreen: talk too fast" {
|
||||
docker exec mail_postscreen_sender /bin/sh -c "nc ${MAIL_POSTSCREEN_IP} 25 < /tmp/docker-mailserver-test/auth/smtp-auth-login.txt"
|
||||
|
||||
|
@ -59,7 +49,3 @@ teardown_file() {
|
|||
repeat_until_success_or_timeout 10 run docker exec mail_postscreen grep 'PASS NEW ' /var/log/mail/mail.log
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -32,10 +24,6 @@ function teardown_file() {
|
|||
docker rm -f mail_privacy
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
# What this test should cover: https://github.com/docker-mailserver/docker-mailserver/issues/681
|
||||
@test "checking postfix: remove privacy details of the sender" {
|
||||
docker exec mail_privacy /bin/sh -c "openssl s_client -quiet -starttls smtp -connect 0.0.0.0:587 < /tmp/docker-mailserver-test/email-templates/send-privacy-email.txt"
|
||||
|
@ -49,7 +37,3 @@ function teardown_file() {
|
|||
assert_success
|
||||
assert_output 0
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -5,14 +5,6 @@ load 'test_helper/common'
|
|||
# When ENABLE_QUOTAS is explicitly disabled (ENABLE_QUOTAS=0), dovecot quota must not be enabled.
|
||||
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -30,10 +22,6 @@ function teardown_file() {
|
|||
docker rm -f mail_no_quotas
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "checking dovecot: (ENABLE_QUOTAS=0) quota plugin is disabled" {
|
||||
run docker exec mail_no_quotas /bin/sh -c "grep '\$mail_plugins quota' /etc/dovecot/conf.d/10-mail.conf"
|
||||
assert_failure
|
||||
|
@ -50,7 +38,3 @@ function teardown_file() {
|
|||
assert_failure
|
||||
}
|
||||
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -27,10 +19,6 @@ 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
|
||||
#
|
||||
|
@ -81,7 +69,3 @@ function teardown_file() {
|
|||
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'
|
||||
}
|
||||
|
|
|
@ -11,13 +11,8 @@ load 'test_helper/common'
|
|||
# SPAMASSASSIN_SPAM_TO_INBOX=1 is covered in `mail_spam_junk_folder.bats`.
|
||||
# Original test PR: https://github.com/docker-mailserver/docker-mailserver/pull/1485
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
docker rm -f "${TEST_NAME}"
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
|
@ -28,10 +23,6 @@ function setup_file() {
|
|||
# function teardown_file() {
|
||||
# }
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "checking amavis: spam message is bounced (rejected)" {
|
||||
# shellcheck disable=SC2034
|
||||
local TEST_DOCKER_ARGS=(
|
||||
|
@ -44,10 +35,6 @@ function setup_file() {
|
|||
_should_bounce_spam
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
||||
function _should_bounce_spam() {
|
||||
wait_for_smtp_port_in_container_to_respond "${TEST_NAME}"
|
||||
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -28,11 +20,6 @@ teardown_file() {
|
|||
docker rm -f mail_special_use_folders
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'only used to call setup_file from setup'
|
||||
}
|
||||
|
||||
|
||||
@test "checking normal delivery" {
|
||||
run docker exec mail_special_use_folders /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
|
||||
assert_success
|
||||
|
@ -52,8 +39,3 @@ teardown_file() {
|
|||
assert_success
|
||||
assert_output 4
|
||||
}
|
||||
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -40,23 +40,10 @@ function setup_file() {
|
|||
# function teardown_file() {
|
||||
# }
|
||||
|
||||
# Applies per test:
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
docker rm -f "${TEST_NAME}"
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
|
||||
# this test must come first to reliably identify when to run setup_file
|
||||
@test "first" {
|
||||
skip 'Starting testing of letsencrypt SSL'
|
||||
}
|
||||
|
||||
|
||||
# Should detect and choose the cert for FQDN `mail.example.test` (HOSTNAME):
|
||||
@test "ssl(letsencrypt): Should default to HOSTNAME (mail.example.test)" {
|
||||
local TARGET_DOMAIN='mail.example.test'
|
||||
|
@ -193,13 +180,6 @@ function teardown() {
|
|||
_acme_wildcard
|
||||
}
|
||||
|
||||
|
||||
# this test is only there to reliably mark the end for the teardown_file
|
||||
@test "last" {
|
||||
skip 'Finished testing of letsencrypt SSL'
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Test Methods
|
||||
#
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
#!/usr/bin/env bats
|
||||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
# Internal copies made by `start-mailserver.sh`:
|
||||
export PRIMARY_KEY='/etc/dms/tls/key'
|
||||
|
@ -46,10 +38,6 @@ function teardown_file() {
|
|||
docker rm -f mail_manual_ssl
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "checking ssl: ENV vars provided are valid files" {
|
||||
assert docker exec mail_manual_ssl [ -f "${SSL_CERT_PATH}" ]
|
||||
assert docker exec mail_manual_ssl [ -f "${SSL_KEY_PATH}" ]
|
||||
|
@ -121,7 +109,3 @@ function teardown_file() {
|
|||
|
||||
sed -i '/someThingsChangedHere/d' "$(pwd)/test/test-files/ssl/${DOMAIN_SSL_MANUAL}/with_ca/ecdsa/key.ecdsa.pem"
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -13,13 +13,8 @@ load 'test_helper/common'
|
|||
# - Verify Postfix and Dovecot use the custom `custom-dhe-params.pem` (contents is actually `ffdhe2048.pem`).
|
||||
# - A warning is raised about usage of potentially insecure parameters.
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
docker rm -f mail_dhparams
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
|
@ -50,10 +45,6 @@ function setup_file() {
|
|||
# function teardown_file() {
|
||||
# }
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "testing tls: DH Parameters - Verify integrity of Default (ffdhe4096)" {
|
||||
# Reference used (22/04/2020):
|
||||
# https://english.ncsc.nl/publications/publications/2019/juni/01/it-security-guidelines-for-transport-layer-security-tls
|
||||
|
@ -105,10 +96,6 @@ function setup_file() {
|
|||
should_emit_warning
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
||||
function common_container_setup() {
|
||||
# shellcheck disable=SC2031
|
||||
docker run -d --name mail_dhparams \
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
|
||||
load 'test_helper/common'
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -28,10 +20,6 @@ teardown_file() {
|
|||
docker rm -f mail_with_imap
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'only used to call setup_file from setup'
|
||||
}
|
||||
|
||||
#
|
||||
# RIMAP
|
||||
#
|
||||
|
@ -52,7 +40,3 @@ teardown_file() {
|
|||
run docker exec mail_with_imap /bin/sh -c "nc -w 5 0.0.0.0 25 < /tmp/docker-mailserver-test/auth/smtp-auth-login.txt | grep 'Authentication successful'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
pushd test/docker-openldap/ || return 1
|
||||
docker build -f Dockerfile -t ldap --no-cache .
|
||||
|
@ -70,10 +62,6 @@ function teardown_file() {
|
|||
docker network rm "${DMS_TEST_NETWORK}"
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'only used to call setup_file from setup'
|
||||
}
|
||||
|
||||
# processes
|
||||
|
||||
@test "checking process: saslauthd (saslauthd server enabled)" {
|
||||
|
@ -255,7 +243,3 @@ function teardown_file() {
|
|||
run docker exec mail_with_ldap /bin/bash -c "pkill saslauthd && sleep 10 && ps aux --forest | grep -v grep | grep '/usr/sbin/saslauthd'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -29,11 +21,6 @@ teardown_file() {
|
|||
docker rm -f mail_with_mdbox_format
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
|
||||
@test "checking dovecot mailbox format: mdbox file created" {
|
||||
run docker exec mail_with_mdbox_format /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
|
||||
assert_success
|
||||
|
@ -41,8 +28,3 @@ teardown_file() {
|
|||
# shellcheck disable=SC2016
|
||||
repeat_until_success_or_timeout 30 docker exec mail_with_mdbox_format /bin/sh -c '[ $(ls /var/mail/localhost.localdomain/user1/storage/m.1 | wc -l) -eq 1 ]'
|
||||
}
|
||||
|
||||
|
||||
@test "last" {
|
||||
skip 'only used to call teardown_file from teardown'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -30,10 +22,6 @@ function teardown_file() {
|
|||
docker rm -f mail_with_postgrey
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "checking postgrey: /etc/postfix/main.cf correctly edited" {
|
||||
run docker exec mail_with_postgrey /bin/bash -c "grep 'zen.spamhaus.org, check_policy_service inet:127.0.0.1:10023' /etc/postfix/main.cf | wc -l"
|
||||
assert_success
|
||||
|
@ -98,7 +86,3 @@ function teardown_file() {
|
|||
assert_success
|
||||
assert_output 1
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
# We use a temporary config directory since we'll be dynamically editing
|
||||
# it with setup.sh.
|
||||
|
@ -33,10 +25,6 @@ function teardown_file() {
|
|||
rm -rf "${tmp_confdir}"
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "checking relay hosts: default mapping is added from env vars" {
|
||||
run docker exec mail_with_relays grep -e domainone.tld /etc/postfix/relayhost_map
|
||||
assert_output -e '^@domainone.tld[[:space:]]+\[default.relay.com\]:2525$'
|
||||
|
@ -85,7 +73,3 @@ function teardown_file() {
|
|||
assert_success
|
||||
assert_output 1
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
load 'test_helper/common'
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container .)"
|
||||
|
@ -29,11 +21,6 @@ teardown_file() {
|
|||
docker rm -f mail_with_sdbox_format
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
|
||||
@test "checking dovecot mailbox format: sdbox file created" {
|
||||
run docker exec mail_with_sdbox_format /bin/sh -c "nc 0.0.0.0 25 < /tmp/docker-mailserver-test/email-templates/existing-user1.txt"
|
||||
assert_success
|
||||
|
@ -41,8 +28,3 @@ teardown_file() {
|
|||
# shellcheck disable=SC2016
|
||||
repeat_until_success_or_timeout 30 docker exec mail_with_sdbox_format /bin/sh -c '[ $(ls /var/mail/localhost.localdomain/user1/mailboxes/INBOX/dbox-Mails/u.1 | wc -l) -eq 1 ]'
|
||||
}
|
||||
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -6,11 +6,6 @@ IMAGE_NAME="${NAME:?Image name must be set}"
|
|||
CONTAINER_NAME='open-dkim'
|
||||
TEST_FILE='OpenDKIM :: '
|
||||
|
||||
function setup
|
||||
{
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
# WHY IS THIS CONTAINER EVEN CREATED WHEN MOST TESTS DO NOT USE IT?
|
||||
function setup_file
|
||||
{
|
||||
|
@ -31,11 +26,6 @@ function setup_file
|
|||
wait_for_finished_setup_in_container "${CONTAINER_NAME}"
|
||||
}
|
||||
|
||||
function teardown
|
||||
{
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown_file
|
||||
{
|
||||
docker rm -f "${CONTAINER_NAME}"
|
||||
|
|
|
@ -3,13 +3,8 @@ load 'test_helper/common'
|
|||
# Globals ${BATS_TMPDIR} and ${NAME}
|
||||
# `${NAME}` defaults to `mailserver-testing:ci`
|
||||
|
||||
function setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
docker rm -f tls_test_cipherlists
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
function setup_file() {
|
||||
|
@ -39,10 +34,6 @@ function teardown_file() {
|
|||
docker network rm "${NETWORK}"
|
||||
}
|
||||
|
||||
@test "first" {
|
||||
skip 'this test must come first to reliably identify when to run setup_file'
|
||||
}
|
||||
|
||||
@test "checking tls: cipher list - rsa intermediate" {
|
||||
check_ports 'rsa' 'intermediate'
|
||||
}
|
||||
|
@ -246,7 +237,3 @@ function get_cipherlist() {
|
|||
echo "${CIPHER_LIST[${TARGET_QUERY}]}"
|
||||
fi
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file'
|
||||
}
|
||||
|
|
|
@ -118,49 +118,6 @@ function wait_for_finished_setup_in_container() {
|
|||
|
||||
SETUP_FILE_MARKER="${BATS_TMPDIR}/$(basename "${BATS_TEST_FILENAME}").setup_file"
|
||||
|
||||
function native_setup_teardown_file_support() {
|
||||
local VERSION_REGEX='([0-9]+)\.([0-9]+)\.([0-9]+)'
|
||||
# bats versions that support setup_file out of the box don't need this
|
||||
if [[ "${BATS_VERSION}" =~ ${VERSION_REGEX} ]]; then
|
||||
numeric_version=$(( (BASH_REMATCH[1] * 100 + BASH_REMATCH[2]) * 100 + BASH_REMATCH[3] ))
|
||||
if [[ ${numeric_version} -ge 10201 ]]; then
|
||||
if [ "${BATS_TEST_NAME}" == 'test_first' ]; then
|
||||
skip 'This version natively supports setup/teardown_file'
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# use in setup() in conjunction with a `@test "first" {}` to trigger setup_file reliably
|
||||
function run_setup_file_if_necessary() {
|
||||
native_setup_teardown_file_support && return 0
|
||||
if [ "${BATS_TEST_NAME}" == 'test_first' ]; then
|
||||
# prevent old markers from marking success or get an error if we cannot remove due to permissions
|
||||
rm -f "${SETUP_FILE_MARKER}"
|
||||
|
||||
setup_file
|
||||
|
||||
touch "${SETUP_FILE_MARKER}"
|
||||
else
|
||||
if [ ! -f "${SETUP_FILE_MARKER}" ]; then
|
||||
skip "setup_file failed"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# use in teardown() in conjunction with a `@test "last" {}` to trigger teardown_file reliably
|
||||
function run_teardown_file_if_necessary() {
|
||||
native_setup_teardown_file_support && return 0
|
||||
if [ "${BATS_TEST_NAME}" == 'test_last' ]; then
|
||||
# cleanup setup file marker
|
||||
rm -f "${SETUP_FILE_MARKER}"
|
||||
teardown_file
|
||||
fi
|
||||
}
|
||||
|
||||
# get the private config path for the given container or test file, if no container name was given
|
||||
function private_config_path() {
|
||||
echo "${PWD}/test/duplicate_configs/${1:-$(basename "${BATS_TEST_FILENAME}")}"
|
||||
|
|
|
@ -5,10 +5,6 @@ load 'test_helper/common'
|
|||
export IMAGE_NAME
|
||||
IMAGE_NAME="${NAME}"
|
||||
|
||||
setup() {
|
||||
run_setup_file_if_necessary
|
||||
}
|
||||
|
||||
setup_file() {
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG="$(duplicate_config_for_container . mail)"
|
||||
|
@ -81,19 +77,10 @@ setup_file() {
|
|||
wait_for_empty_mail_queue_in_container mail
|
||||
}
|
||||
|
||||
teardown() {
|
||||
run_teardown_file_if_necessary
|
||||
}
|
||||
|
||||
teardown_file() {
|
||||
docker rm -f mail
|
||||
}
|
||||
|
||||
# this test must come first to reliably identify when to run setup_file
|
||||
@test "first" {
|
||||
skip 'Starting testing of letsencrypt SSL'
|
||||
}
|
||||
|
||||
#
|
||||
# configuration checks
|
||||
#
|
||||
|
@ -1253,7 +1240,3 @@ EOF
|
|||
run docker exec mail grep "Subject: Root Test Message" /var/mail/localhost.localdomain/user1/new/ -R
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "last" {
|
||||
skip 'this test is only there to reliably mark the end for the teardown_file (test.bats finished)'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue