Skip to content

Commit

Permalink
Improve compose test script
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Feb 18, 2022
1 parent 4b17263 commit b107bdf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions compose-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ if [[ -z "${GITHUB_HEAD_REF##*/}" ]]; then
else
echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" > .env
fi
docker-compose -f api-tests/docker-compose.yml up -d
echo "Building API"
docker-compose -f api-tests/docker-compose.yml build api
echo "Starting Consul Agent"
docker-compose -f api-tests/docker-compose.yml up -d consul-agent
sleep 1
echo "Starting API"
docker-compose -f api-tests/docker-compose.yml up -d api
sleep 10
echo "Testing API"
curl --fail http://localhost:8080/echo/hello
curl --fail http://localhost:8500/v1/agent/services
curl --fail http://localhost:8500/v1/health/checks/echo
HEALTH_STATUS=$(curl -s http://localhost:8500/v1/health/checks/echo | jq '.[0].Status')
if [ "$HEALTH_STATUS" != "passing" ]; then
echo "ERROR: Echo service is unhealthy"
echo "$HEALTH_STATUS"
if [ "$HEALTH_STATUS" != '"passing"' ]; then
echo "Error: Echo service is unhealthy" >&2
docker-compose -f api-tests/docker-compose.yml down
exit 1
fi
Expand Down

0 comments on commit b107bdf

Please sign in to comment.