Add Travis test
This commit is contained in:
parent
17030f8468
commit
4b9db5b83b
18
.travis.yml
18
.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
|
||||
|
|
|
|||
36
test.sh
Executable file
36
test.sh
Executable file
|
|
@ -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
|
||||
Loading…
Reference in a new issue