Skip to content

Commit

Permalink
Cleanup: bash vars
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
phlax committed Aug 20, 2020
1 parent 9758da4 commit 03c89e4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions examples/verify-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ bring_up_example_stack () {
}

bring_up_example () {
local paths
local path paths
read -ra paths <<< "$(echo "$PATHS" | tr ',' ' ')"
for path in "${paths[@]}"; do
pushd "$path" > /dev/null || return 1
bring_up_example_stack "$path" || {
echo "ERROR: starting ${NAME} ${path}" >&2
return 1
}
popd > /dev/null
popd > /dev/null || return 1
done
if [[ "$DELAY" -ne "0" ]]; then
run_log "Snooze for ${DELAY} while ${NAME} gets started"
Expand All @@ -43,9 +43,8 @@ bring_up_example () {
pushd "$path" > /dev/null || return 1
docker-compose ps
docker-compose logs
popd > /dev/null
popd > /dev/null || return 1
done

}

cleanup_stack () {
Expand All @@ -57,7 +56,7 @@ cleanup_stack () {
}

cleanup () {
local paths
local path paths
read -ra paths <<< "$(echo "$PATHS" | tr ',' ' ')"
for path in "${paths[@]}"; do
pushd "$path" > /dev/null || return 1
Expand All @@ -70,7 +69,7 @@ cleanup () {
}

_curl () {
local curl_command
local arg curl_command
curl_command=(curl -s)
if [[ ! "$*" =~ "-X" ]]; then
curl_command+=(-X GET)
Expand All @@ -85,7 +84,7 @@ _curl () {
}

responds_with () {
local curl_command expected
local expected
expected="$1"
shift
_curl "${@}" | grep "$expected" || {
Expand All @@ -105,7 +104,7 @@ responds_with_header () {
}

responds_without_header () {
local curl_command expected
local expected
expected="$1"
shift
_curl --head "${@}" | grep "$expected" | [[ "$(wc -l)" -eq 0 ]] || {
Expand Down

0 comments on commit 03c89e4

Please sign in to comment.