Skip to content

Commit d009438

Browse files
authored
Merge pull request #10 from cyberark/conjurinc-ops-423
Retry command is evaluated
2 parents 19b82c3 + 225232d commit d009438

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

helpers/lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function retry {
4646
fi
4747

4848
local count=0
49-
until "$@"; do
49+
until eval "$@"; do
5050
# Command failed, otherwise until would have skipped the loop
5151

5252
# Store return code so it can be reported to the user

init

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ for lib in helpers logging filehandling git k8s test-utils; do
2424
. "${BASH_LIB_DIR_RELATIVE}/${lib}/lib"
2525
done
2626

27+
# Export functions to subshells
28+
eval "$(declare -F | sed -e 's/-f /-fx /')"
29+
2730
# Export the absolute path
2831
# shellcheck disable=SC2086
2932
BASH_LIB_DIR="$(abs_path ${BASH_LIB_DIR_RELATIVE})"

tests-for-this-repo/helpers.bats

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,8 @@ teardown(){
111111
assert [ ! -e "${temp_dir}/appendfile" ]
112112
}
113113

114-
114+
@test "retry succeeds with compound statements" {
115+
run retry 3 "true && date >> ${afile}"
116+
assert_success
117+
assert_equal $(wc -l <${afile}) 1
118+
}

0 commit comments

Comments
 (0)