From 5ca27fbeff2dd9f6055814a66e41ef8ce47365fb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 9 Mar 2019 15:24:20 -0500 Subject: [PATCH] fix: correct ID check It may be true in tests because we mock docker itself... --- common-functions | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common-functions b/common-functions index a2c0827..697fcd7 100755 --- a/common-functions +++ b/common-functions @@ -277,9 +277,12 @@ service_container_rm() { declare desc="Stops a service and removes the running container" declare SERVICE="$1" local SERVICE_NAME="$(get_service_name "$SERVICE")" + local ID service_stop "$SERVICE" - if ! docker inspect "$SERVICE_NAME" -f '{{ .ID }}' > /dev/null 2>&1; then + ID=$(docker inspect "$SERVICE_NAME" -f '{{ .ID }}' > /dev/null 2>&1 || true) + # this may be 'true' in tests... + if [[ -z "$ID" ]] || [[ "$ID" == "true" ]]; then return 0 fi