mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-02 09:05:14 +02:00
ci: fix ShellCheck linting for BATS tests (#3347)
* updated `lint.sh` to lint BATS (again) * fix linting errors
This commit is contained in:
parent
1d2df8d499
commit
abd72b6f10
11 changed files with 51 additions and 14 deletions
|
@ -193,6 +193,7 @@ function _should_be_configured_to_fqdn() {
|
|||
assert_success
|
||||
|
||||
# Amavis
|
||||
# shellcheck disable=SC2016
|
||||
_run_in_container grep '^\$myhostname' /etc/amavis/conf.d/05-node_id
|
||||
assert_output "\$myhostname = \"${EXPECTED_FQDN}\";"
|
||||
assert_success
|
||||
|
|
|
@ -179,12 +179,12 @@ function _should_restart_when_killed() {
|
|||
function _check_if_process_is_running() {
|
||||
local PROCESS=${1}
|
||||
local MIN_SECS_RUNNING
|
||||
[[ -n ${2} ]] && MIN_SECS_RUNNING="--older ${2}"
|
||||
[[ -n ${2:-} ]] && MIN_SECS_RUNNING=('--older' "${2}")
|
||||
|
||||
local IS_RUNNING=$(docker exec "${CONTAINER_NAME}" pgrep --list-full ${MIN_SECS_RUNNING} "${PROCESS}")
|
||||
local IS_RUNNING=$(docker exec "${CONTAINER_NAME}" pgrep --list-full "${MIN_SECS_RUNNING[@]}" "${PROCESS}")
|
||||
|
||||
# When no matches are found, nothing is returned. Provide something we can assert on (helpful for debugging):
|
||||
if [[ ! ${IS_RUNNING} =~ "${PROCESS}" ]]
|
||||
if [[ ! ${IS_RUNNING} =~ ${PROCESS} ]]
|
||||
then
|
||||
echo "'${PROCESS}' is not running"
|
||||
return 1
|
||||
|
|
|
@ -4,6 +4,7 @@ BATS_TEST_NAME_PREFIX='[Scripts] (helper functions) '
|
|||
SOURCE_BASE_PATH="${REPOSITORY_ROOT:?Expected REPOSITORY_ROOT to be set}/target/scripts/helpers"
|
||||
|
||||
@test '(network.sh) _sanitize_ipv4_to_subnet_cidr' {
|
||||
# shellcheck source=../../../../../target/scripts/helpers/network.sh
|
||||
source "${SOURCE_BASE_PATH}/network.sh"
|
||||
|
||||
run _sanitize_ipv4_to_subnet_cidr '255.255.255.255/0'
|
||||
|
@ -17,7 +18,9 @@ SOURCE_BASE_PATH="${REPOSITORY_ROOT:?Expected REPOSITORY_ROOT to be set}/target/
|
|||
}
|
||||
|
||||
@test '(utils.sh) _env_var_expect_zero_or_one' {
|
||||
# shellcheck source=../../../../../target/scripts/helpers/log.sh
|
||||
source "${SOURCE_BASE_PATH}/log.sh"
|
||||
# shellcheck source=../../../../../target/scripts/helpers/utils.sh
|
||||
source "${SOURCE_BASE_PATH}/utils.sh"
|
||||
|
||||
ZERO=0
|
||||
|
@ -40,7 +43,9 @@ SOURCE_BASE_PATH="${REPOSITORY_ROOT:?Expected REPOSITORY_ROOT to be set}/target/
|
|||
}
|
||||
|
||||
@test '(utils.sh) _env_var_expect_integer' {
|
||||
# shellcheck source=../../../../../target/scripts/helpers/log.sh
|
||||
source "${SOURCE_BASE_PATH}/log.sh"
|
||||
# shellcheck source=../../../../../target/scripts/helpers/utils.sh
|
||||
source "${SOURCE_BASE_PATH}/utils.sh"
|
||||
|
||||
INTEGER=1234
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue