Skip to content

Commit

Permalink
Print diagnostic messages to stderr when testing docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Mar 17, 2023
1 parent d08881b commit 8a271dc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions core/docker/container-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,27 @@ function test_trino_starts {
I=0
until docker inspect "${CONTAINER_ID}" --format "{{json .State.Health.Status }}" | grep -q '"healthy"'; do
if [[ $((I++)) -ge ${QUERY_RETRIES} ]]; then
echo "🚨 Too many retries waiting for Trino to start"
echo "🚨 Too many retries waiting for Trino to start" >&2
echo "Logs from ${CONTAINER_ID} follow..."
docker logs "${CONTAINER_ID}"
break
fi
sleep ${QUERY_PERIOD}
done
if ! RESULT=$(docker exec "${CONTAINER_ID}" trino --execute "SELECT 'success'" 2>/dev/null); then
echo "🚨 Failed to execute a query after Trino container started"
echo "🚨 Failed to execute a query after Trino container started" >&2
fi
set -e

cleanup
trap - EXIT

# Return proper exit code.
[[ ${RESULT} == '"success"' ]]
if ! [[ ${RESULT} == '"success"' ]]; then
echo "🚨 Test query didn't return expected result (\"success\")" >&2
return 1
fi

return 0
}

function test_javahome {
Expand Down

0 comments on commit 8a271dc

Please sign in to comment.