Skip to content

Commit

Permalink
Tests fix (#4)
Browse files Browse the repository at this point in the history
Tests fix - final 😃
  • Loading branch information
jendakol authored Oct 6, 2018
1 parent 6416fae commit 4b9a13c
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 4b9a13c

Please sign in to comment.