first run at integ test using docker-compose

This commit is contained in:
josebarn
2017-08-16 08:30:40 -03:00
parent e2ca326b66
commit b138870433
8 changed files with 57 additions and 22 deletions

View File

@@ -0,0 +1,13 @@
sleep 5
ping -c 5 target
curl -X POST target:8080/api/id/1
if curl -X POST target:8080/api/id/1 | grep -q '{"op":"POST","id":1}'; then
echo "Tests passed!"
exit 0
else
echo "Tests failed!"
exit 1
fi

13
script/drone-run-tests.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
# remove old containers
docker-compose -p ci --file docker-compose.test.yml rm -f
# run tests
docker-compose -p ci --file docker-compose.test.yml up --build
echo "Inspecting exited containers:"
docker-compose -p ci --file docker-compose.test.yml ps
docker-compose -p ci --file docker-compose.test.yml ps -q | xargs docker inspect -f '{{ .State.ExitCode }}' | while read code; do
if [ "$code" != "0" ]; then
exit $code
fi
done