mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-04 01:55:29 +02:00
ci: move tests than can be run in parallel now (#3038)
This commit is contained in:
parent
66f3bbc062
commit
e6dee0f2f1
22 changed files with 2 additions and 1 deletions
77
test/tests/parallel/set1/fetchmail.bats
Normal file
77
test/tests/parallel/set1/fetchmail.bats
Normal file
|
@ -0,0 +1,77 @@
|
|||
load "${REPOSITORY_ROOT}/test/helper/common"
|
||||
load "${REPOSITORY_ROOT}/test/helper/setup"
|
||||
|
||||
BATS_TEST_NAME_PREFIX='[Fetchmail] '
|
||||
CONTAINER1_NAME='dms-test_fetchmail'
|
||||
CONTAINER2_NAME='dms-test_fetchmail_parallel'
|
||||
|
||||
function setup_file() {
|
||||
export CONTAINER_NAME
|
||||
|
||||
CONTAINER_NAME=${CONTAINER1_NAME}
|
||||
local CUSTOM_SETUP_ARGUMENTS=(
|
||||
--env ENABLE_FETCHMAIL=1
|
||||
)
|
||||
_init_with_defaults
|
||||
mv "${TEST_TMP_CONFIG}/fetchmail/fetchmail.cf" "${TEST_TMP_CONFIG}/fetchmail.cf"
|
||||
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
|
||||
|
||||
CONTAINER_NAME=${CONTAINER2_NAME}
|
||||
local CUSTOM_SETUP_ARGUMENTS=(
|
||||
--env ENABLE_FETCHMAIL=1
|
||||
--env FETCHMAIL_PARALLEL=1
|
||||
)
|
||||
_init_with_defaults
|
||||
mv "${TEST_TMP_CONFIG}/fetchmail/fetchmail.cf" "${TEST_TMP_CONFIG}/fetchmail.cf"
|
||||
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
|
||||
}
|
||||
|
||||
function teardown_file() {
|
||||
docker rm -f "${CONTAINER1_NAME}" "${CONTAINER2_NAME}"
|
||||
}
|
||||
|
||||
# ENV `FETCHMAIL=1` runs `setup-stack.sh:_setup_fetchmail()`:
|
||||
@test "(ENV ENABLE_FETCHMAIL=1) should configure /etc/fetchmailrc with fetchmail.cf contents" {
|
||||
export CONTAINER_NAME=${CONTAINER1_NAME}
|
||||
# /etc/fetchmailrc was created with general options copied from /etc/fetchmailrc_general:
|
||||
_should_have_in_config 'set syslog' /etc/fetchmailrc
|
||||
# fetchmail.cf content is appended into /etc/fetchmailrc:
|
||||
# NOTE: FQDN value ends with a dot intentionally to avoid misleading DNS response:
|
||||
# https://github.com/docker-mailserver/docker-mailserver/pull/1324
|
||||
_should_have_in_config 'pop3.third-party.test.' /etc/fetchmailrc
|
||||
}
|
||||
|
||||
# ENV `FETCHMAIL=1` runs `setup-stack.sh:_setup_fetchmail_parallel()`:
|
||||
# fetchmail.cf should be parsed and split into multiple separate fetchmail configs:
|
||||
# NOTE: Parallel fetchmail instances are checked in the `process-check-restart.bats` test.
|
||||
@test "(ENV FETCHMAIL_PARALLEL=1) should create config fetchmail-1.rc" {
|
||||
export CONTAINER_NAME=${CONTAINER2_NAME}
|
||||
|
||||
_should_have_in_config 'set syslog' /etc/fetchmailrc.d/fetchmail-1.rc
|
||||
_should_have_in_config 'pop3.third-party.test.' /etc/fetchmailrc.d/fetchmail-1.rc
|
||||
_should_not_have_in_config 'imap.remote-service.test.' /etc/fetchmailrc.d/fetchmail-1.rc
|
||||
}
|
||||
|
||||
@test "(ENV FETCHMAIL_PARALLEL=1) should create config fetchmail-2.rc" {
|
||||
export CONTAINER_NAME=${CONTAINER2_NAME}
|
||||
|
||||
_should_have_in_config 'set syslog' /etc/fetchmailrc.d/fetchmail-2.rc
|
||||
_should_have_in_config 'imap.remote-service.test.' /etc/fetchmailrc.d/fetchmail-2.rc
|
||||
_should_not_have_in_config 'pop3.third-party.test. ' /etc/fetchmailrc.d/fetchmail-2.rc
|
||||
}
|
||||
|
||||
function _should_have_in_config() {
|
||||
local MATCH_CONTENT=$1
|
||||
local MATCH_IN_FILE=$2
|
||||
|
||||
_run_in_container grep -F "${MATCH_CONTENT}" "${MATCH_IN_FILE}"
|
||||
assert_success
|
||||
}
|
||||
|
||||
function _should_not_have_in_config() {
|
||||
local MATCH_CONTENT=$1
|
||||
local MATCH_IN_FILE=$2
|
||||
|
||||
_run_in_container grep -F "${MATCH_CONTENT}" "${MATCH_IN_FILE}"
|
||||
assert_failure
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue