add `_file_does_not_exist_in_container`
- counterpart to `_file_exists_in_container` - usage was adjusted in all Rspamd-related tests and in Amavis tests
This commit is contained in:
parent
fb0fba9da7
commit
c593999da8
|
@ -425,5 +425,13 @@ function _file_exists_in_container() {
|
|||
assert_success
|
||||
}
|
||||
|
||||
# A simple wrapper for a test that checks whether a file does not exist.
|
||||
#
|
||||
# @param ${1} = the path to the file (that should not exists) inside the container
|
||||
function _file_does_not_exist_in_container() {
|
||||
_run_in_container_bash "[[ -f ${1} ]]"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
# ? << Miscellaneous helper functions
|
||||
# ! -------------------------------------------------------------------
|
||||
|
|
|
@ -45,8 +45,7 @@ function teardown_file() {
|
|||
_run_in_container grep -F '127.0.0.1:10025' /etc/postfix/master.cf
|
||||
assert_success
|
||||
|
||||
_run_in_container_bash '[[ ! -f /etc/cron.d/amavisd-new.disabled ]]'
|
||||
assert_success
|
||||
_file_does_not_exist_in_container /etc/cron.d/amavisd-new.disabled
|
||||
_file_exists_in_container /etc/cron.d/amavisd-new
|
||||
}
|
||||
|
||||
|
@ -93,6 +92,5 @@ function teardown_file() {
|
|||
assert_failure
|
||||
|
||||
_file_exists_in_container /etc/cron.d/amavisd-new.disabled
|
||||
_run_in_container_bash '[[ ! -f /etc/cron.d/amavisd-new ]]'
|
||||
assert_success
|
||||
_file_does_not_exist_in_container /etc/cron.d/amavisd-new
|
||||
}
|
||||
|
|
|
@ -62,8 +62,7 @@ function teardown_file() { _default_teardown ; }
|
|||
assert_output --partial "Supplying a default configuration (to '${SIGNING_CONF_FILE}')"
|
||||
refute_output --partial "'${SIGNING_CONF_FILE}' exists, not supplying a default"
|
||||
assert_output --partial "Finished DKIM key creation"
|
||||
_run_in_container_bash "[[ -f ${SIGNING_CONF_FILE} ]]"
|
||||
assert_success
|
||||
_file_exists_in_container "${SIGNING_CONF_FILE}"
|
||||
_exec_in_container_bash "echo 'blabla' >${SIGNING_CONF_FILE}"
|
||||
local INITIAL_SHA512_SUM=$(_exec_in_container sha512sum "${SIGNING_CONF_FILE}")
|
||||
|
||||
|
@ -87,8 +86,7 @@ function teardown_file() { _default_teardown ; }
|
|||
assert_success
|
||||
|
||||
_count_files_in_directory_in_container /tmp/docker-mailserver/rspamd/dkim/ 3
|
||||
_run_in_container_bash "[[ -f ${SIGNING_CONF_FILE} ]]"
|
||||
assert_success
|
||||
_file_exists_in_container "${SIGNING_CONF_FILE}"
|
||||
|
||||
__check_path_in_signing_config "/tmp/docker-mailserver/rspamd/dkim/rsa-2048-mail-${DOMAIN_NAME}.private.txt"
|
||||
__check_selector_in_signing_config 'mail'
|
||||
|
@ -241,8 +239,7 @@ function __check_rsa_keys() {
|
|||
function __check_key_files_are_present() {
|
||||
local BASE_FILE_NAME="${1:?Base file name must be supplied to __check_key_files_are_present}"
|
||||
for FILE in ${BASE_FILE_NAME}.{public.txt,public.dns.txt,private.txt}; do
|
||||
_run_in_container_bash "[[ -f ${FILE} ]]"
|
||||
assert_success
|
||||
_file_exists_in_container "${FILE}"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,7 @@ function teardown_file() { _default_teardown ; }
|
|||
|
||||
@test 'learning is properly disabled' {
|
||||
for FILE in learn-{ham,spam}.{sieve,svbin}; do
|
||||
_run_in_container_bash "[[ -f /usr/lib/dovecot/sieve-pipe/${FILE} ]]"
|
||||
assert_failure
|
||||
_file_does_not_exist_in_container "/usr/lib/dovecot/sieve-pipe/${FILE}"
|
||||
done
|
||||
|
||||
_run_in_container grep 'mail_plugins.*imap_sieve' /etc/dovecot/conf.d/20-imap.conf
|
||||
|
@ -84,14 +83,13 @@ function teardown_file() { _default_teardown ; }
|
|||
}
|
||||
|
||||
@test 'hfilter group module configuration is deleted' {
|
||||
_run_in_container_bash '[[ -f /etc/rspamd/local.d/hfilter_group.conf ]]'
|
||||
_file_does_not_exist_in_container /etc/rspamd/local.d/hfilter_group.conf
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test 'checks on authenticated users are enabled' {
|
||||
local MODULE_FILE='/etc/rspamd/local.d/settings.conf'
|
||||
_run_in_container_bash "[[ -f ${MODULE_FILE} ]]"
|
||||
assert_success
|
||||
_file_exists_in_container "${MODULE_FILE}"
|
||||
|
||||
_run_in_container grep -E 'authenticated \{' "${MODULE_FILE}"
|
||||
assert_failure
|
||||
|
|
Loading…
Reference in New Issue