diff --git a/.travis.sh b/.travis.sh index 30bfe67..8af8425 100755 --- a/.travis.sh +++ b/.travis.sh @@ -2,24 +2,32 @@ function wait_for_service() { n=0 - until [ $n -ge 5 ] + until [ $n -ge 30 ] do echo -e "Waiting for rbackup" - curl "http://localhost:3369/status" 2> /dev/null > /dev/null && break + + if [ "$(curl "http://localhost:3369/status" 2>/dev/null)" == "{\"status\": \"RBackup running\"}" ]; then + break + fi + n=$[$n+1] - sleep 1 + sleep 2 done + if [ $n -ge 30 ]; then + exit 1 + fi + echo -e "rbackup ready" } function rbackup_test { - docker build -t rbackup . \ - && cd tests \ - && docker-compose up -d --build --force-recreate \ - && wait_for_service \ - && ./tests.sh \ - && docker-compose down + docker build -t rbackup . && \ + cd tests && \ + docker-compose up -d --build --force-recreate && \ + wait_for_service && \ + ./tests.sh && \ + docker-compose down } function rbackup_publish { @@ -36,7 +44,7 @@ function rbackup_publish { sudo apt-get -qq update \ && sudo apt-get install -y jq && \ rbackup_test && - if $(test ${TRAVIS_REPO_SLUG} == "jendakol/rbackup" && test ${TRAVIS_PULL_REQUEST} == "false" && test "$TRAVIS_TAG" != ""); then + if $(test "${TRAVIS_REPO_SLUG}" == "jendakol/rbackup" && test "${TRAVIS_PULL_REQUEST}" == "false" && test "$TRAVIS_TAG" != ""); then rbackup_publish else exit 0 # skipping publish, it's regular build