mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-15 03:44:56 +02:00
removal: configomat (submodule) (#3045)
This commit is contained in:
parent
9df71c27a0
commit
00b1d88ed7
11 changed files with 114 additions and 17 deletions
6
test/config/override-configs/replace_by_env_in_file.conf
Normal file
6
test/config/override-configs/replace_by_env_in_file.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
key_1 = value
|
||||
key_2 =
|
||||
key_3 =value
|
||||
key_4= value
|
||||
key_5=value
|
||||
key_6 = value
|
|
@ -51,8 +51,7 @@ function _shellcheck
|
|||
# File paths for shellcheck:
|
||||
F_SH=$(find . -type f -iname '*.sh' \
|
||||
-not -path './test/bats/*' \
|
||||
-not -path './test/test_helper/*' \
|
||||
-not -path './target/docker-configomat/*'
|
||||
-not -path './test/test_helper/*'
|
||||
)
|
||||
# shellcheck disable=SC2248
|
||||
F_BIN=$(find 'target/bin' -type f -not -name '*.py')
|
||||
|
|
52
test/tests/parallel/set3/scripts/replace_by_env_in_file.bats
Normal file
52
test/tests/parallel/set3/scripts/replace_by_env_in_file.bats
Normal file
|
@ -0,0 +1,52 @@
|
|||
load "${REPOSITORY_ROOT}/test/helper/common"
|
||||
source "${REPOSITORY_ROOT}/target/scripts/helpers/log.sh"
|
||||
source "${REPOSITORY_ROOT}/target/scripts/helpers/utils.sh"
|
||||
|
||||
BATS_TEST_NAME_PREFIX='[Helper function] (_replace_by_env_in_file) '
|
||||
|
||||
function setup_file() {
|
||||
export TMP_CONFIG_FILE=$(mktemp)
|
||||
cp "${REPOSITORY_ROOT}/test/config/override-configs/replace_by_env_in_file.conf" "${TMP_CONFIG_FILE}"
|
||||
}
|
||||
|
||||
function teardown_file() { rm "${TMP_CONFIG_FILE}" ; }
|
||||
|
||||
@test "substitute key-value pair (01) (normal substitutions)" {
|
||||
export TEST_KEY_1='new_value_1'
|
||||
_do_work "key_1 = ${TEST_KEY_1}"
|
||||
export TEST_KEY_1='(&(objectClass=PostfixBookMailAccount)(|(uniqueIdentifier=%n)(mail=%u)))'
|
||||
_do_work "key_1 = ${TEST_KEY_1}"
|
||||
export TEST_KEY_1="*+=/_-%&"
|
||||
_do_work "key_1 = ${TEST_KEY_1}"
|
||||
export TEST_KEY_1='(&(objectClass=mailAccount)(uid=%n))'
|
||||
_do_work "key_1 = ${TEST_KEY_1}"
|
||||
export TEST_KEY_1='=home=/var/mail/%{ldap:mail}, =mail=maildir:/var/mail/%{ldap:mail}/Maildir'
|
||||
_do_work "key_1 = ${TEST_KEY_1}"
|
||||
export TEST_KEY_1='(&(objectClass=mailAccount)(uid=%n))'
|
||||
_do_work "key_1 = ${TEST_KEY_1}"
|
||||
export TEST_KEY_1='uid=user,userPassword=password'
|
||||
_do_work "key_1 = ${TEST_KEY_1}"
|
||||
}
|
||||
|
||||
@test "substitute key-value pair (08) (spaces / no values)" {
|
||||
export TEST_KEY_2='new_value_2'
|
||||
_do_work "key_2 = ${TEST_KEY_2}"
|
||||
export TEST_KEY_3='new_value_3'
|
||||
_do_work "key_3 = ${TEST_KEY_3}"
|
||||
export TEST_KEY_4="new_value_4"
|
||||
_do_work "key_4 = ${TEST_KEY_4}"
|
||||
export TEST_KEY_5="new_value_5"
|
||||
_do_work "key_5 = ${TEST_KEY_5}"
|
||||
export TEST_KEY_6=
|
||||
_do_work "key_6 ="
|
||||
run grep -q -F "key_6 = " "${TMP_CONFIG_FILE}"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
function _do_work() {
|
||||
local FILTER_STRING=${1:?No string to filter by was provided}
|
||||
run _replace_by_env_in_file 'TEST_' "${TMP_CONFIG_FILE}"
|
||||
assert_success
|
||||
run grep -q -F "${FILTER_STRING}" "${TMP_CONFIG_FILE}"
|
||||
assert_success
|
||||
}
|
|
@ -23,7 +23,7 @@ function setup_file() {
|
|||
--tty \
|
||||
ldap # Image name
|
||||
|
||||
# _setup_ldap uses configomat with .ext files and ENV vars like DOVECOT_TLS with a prefix (eg DOVECOT_ or LDAP_)
|
||||
# _setup_ldap uses _replace_by_env_in_file with ENV vars like DOVECOT_TLS with a prefix (eg. DOVECOT_ or LDAP_)
|
||||
local PRIVATE_CONFIG
|
||||
PRIVATE_CONFIG=$(duplicate_config_for_container .)
|
||||
docker run -d --name mail_with_ldap \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue