diff --git a/.travis.yml b/.travis.yml index 0f5f999..1b80bd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,16 @@ language: generic + dist: trusty + env: - - DOCKER_COMPOSE_VERSION=1.17.1 + - file: postgres.yml + + - file: mysql.yml + + - file: activemq.yml + services: - docker -before_install: - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin + script: - - docker-compose -f mysql.yml up -d - - curl -sSf localhost/healthcheck > /dev/null + - ./test.sh diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..7f537d7 --- /dev/null +++ b/test.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Check if the yml exists +if [[ ! -f $file ]]; then + echo "File $file doesn't exist!" + exit 1 +fi + +# Run test environment +docker-compose -p ds -f $file up -d + +wakeup_attempts=30 +wakeup_timeout=5 + +for ((i=0; i<$wakeup_attempts; i++)) +do + # Get documentserver healthcheck status + healthcheck_res=$(wget --no-check-certificate -qO - localhost/healthcheck) + + if [[ $healthcheck_res == "true" ]]; then + break + else + echo "Wait for service wake up #$i" + sleep $wakeup_timeout + fi +done + +# Fail if it isn't true +if [[ $healthcheck_res == "true" ]]; then + echo "Healthcheck passed." +else + echo "Healthcheck failed!" + exit 1 +fi + +docker-compose -p ds -f $file down \ No newline at end of file