From 8512dba8adeef3f73fa4d9ffbb2e309c2df64d4e Mon Sep 17 00:00:00 2001 From: Casper Date: Fri, 26 May 2023 07:42:03 +0200 Subject: [PATCH] Change 'until' style (#3366) --- test/helper/common.bash | 9 +++------ test/test_helper/common.bash | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/test/helper/common.bash b/test/helper/common.bash index 34b5f97c..cc0eda3d 100644 --- a/test/helper/common.bash +++ b/test/helper/common.bash @@ -182,8 +182,7 @@ function _repeat_until_success_or_timeout() { local STARTTIME=${SECONDS} - until "${@}" - do + until "${@}"; do if [[ -n ${FATAL_FAILURE_TEST_COMMAND} ]] && ! eval "${FATAL_FAILURE_TEST_COMMAND}"; then echo "\`${FATAL_FAILURE_TEST_COMMAND}\` failed, early aborting repeat_until_success of \`${*}\`" >&2 return 1 @@ -215,8 +214,7 @@ function _run_until_success_or_timeout() { local STARTTIME=${SECONDS} # shellcheck disable=SC2154 - until run "${@}" && [[ ${status} -eq 0 ]] - do + until run "${@}" && [[ ${status} -eq 0 ]]; do sleep 1 if (( SECONDS - STARTTIME > TIMEOUT )); then @@ -260,8 +258,7 @@ function _wait_for_smtp_port_in_container_to_respond() { local CONTAINER_NAME=$(__handle_container_name "${1:-}") local COUNT=0 - until [[ $(_exec_in_container timeout 10 /bin/bash -c 'echo QUIT | nc localhost 25') == *'221 2.0.0 Bye'* ]] - do + until [[ $(_exec_in_container timeout 10 /bin/bash -c 'echo QUIT | nc localhost 25') == *'221 2.0.0 Bye'* ]]; do if [[ ${COUNT} -eq 20 ]]; then echo "Unable to receive a valid response from 'nc localhost 25' within 20 seconds" return 1 diff --git a/test/test_helper/common.bash b/test/test_helper/common.bash index 15287ff6..979b3c08 100644 --- a/test/test_helper/common.bash +++ b/test/test_helper/common.bash @@ -37,8 +37,7 @@ function repeat_until_success_or_timeout { local STARTTIME=${SECONDS} shift 1 - until "${@}" - do + until "${@}"; do if [[ -n ${FATAL_FAILURE_TEST_COMMAND} ]] && ! eval "${FATAL_FAILURE_TEST_COMMAND}"; then echo "\`${FATAL_FAILURE_TEST_COMMAND}\` failed, early aborting repeat_until_success of \`${*}\`" >&2 return 1 @@ -66,8 +65,7 @@ function run_until_success_or_timeout { local STARTTIME=${SECONDS} shift 1 - until run "${@}" && [[ $status -eq 0 ]] - do + until run "${@}" && [[ $status -eq 0 ]]; do sleep 1 if (( SECONDS - STARTTIME > TIMEOUT )); then