From 924baf461c348874e4a8ca2be8f7e9a632eb51d3 Mon Sep 17 00:00:00 2001 From: Aditya Prakash Date: Tue, 14 May 2019 16:23:51 +0530 Subject: [PATCH] Test ping api for docker image Would fail if we couldn't boot docker or unicorn/rails crashes. --- script/build_docker.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/script/build_docker.sh b/script/build_docker.sh index 2ec1447db06..889d0de2448 100755 --- a/script/build_docker.sh +++ b/script/build_docker.sh @@ -16,6 +16,16 @@ echo "$TRAVIS_COMMIT" > REVISION docker build -t quay.io/$TRAVIS_REPO_SLUG:$TRAVIS_COMMIT . +docker run --net host quay.io/$TRAVIS_REPO_SLUG:$TRAVIS_COMMIT rake db:create db:migrate +docker run -d --net host quay.io/$TRAVIS_REPO_SLUG:$TRAVIS_COMMIT +sleep 10 +curl http://localhost:3000/internal/ping | grep PONG + +if [ $? -eq 1 ]; then + echo "Internal ping api test didn't pass." + exit 1 +fi + if [ -z "$DOCKER_USERNAME" ] || [ -z "$DOCKER_PASSWORD" ] then exit 0