Skip to content
Snippets Groups Projects
Commit c7cf82b1 authored by Ryan Sanford's avatar Ryan Sanford
Browse files

Delay integration tests until core is up

parent 54efa940
No related branches found
No related tags found
No related merge requests found
......@@ -26,21 +26,49 @@ case "$1-$2" in
integration---ci|integration-)
# Bootstrap and run integration test.
# - always stop and remove docker containers
# - always exit non-zero if either bootstrap or integration tests fail.
# - always exit non-zero if either bootstrap or integration tests fail
# - only execute tests after core is confirmed up
# - only run integration tests on bootstrap success
docker-compose \
-f test/docker-compose.yml \
run \
--rm \
bootstrap && \
docker-compose \
-f test/docker-compose.yml \
run \
--rm \
integration-test || \
exit_code=1
docker-compose -f test/docker-compose.yml down
# launch core
docker-compose \
-f test/docker-compose.yml \
up \
-d \
scitran-core &&
# wait for core to be ready.
(
for((i=1;i<=30;i++))
do
# ignore return code
apiResponse=$(docker-compose -f test/docker-compose.yml run --rm core-check) && true
# reformat response string for comparison
apiResponse="${apiResponse//[$'\r\n ']}"
if [ "${apiResponse}" == "200" ] ; then
>&2 echo "INFO: Core API is available."
exit 0
fi
>&2 echo "INFO (${apiResponse}): Waiting for Core API to become available after ${i} attempts to connect."
sleep 1
done
exit 1
) &&
# execute tests
docker-compose \
-f test/docker-compose.yml \
run \
--rm \
bootstrap &&
docker-compose \
-f test/docker-compose.yml \
run \
--rm \
integration-test ||
# set failure exit code in the event any previous commands in chain failed.
exit_code=1
docker-compose -f test/docker-compose.yml down -v
exit $exit_code
;;
integration---watch)
......
......@@ -40,3 +40,9 @@ services:
- mongo
volumes:
- ./integration_tests:/usr/src/tests
core-check:
extends: scitran-base
links:
- scitran-core
entrypoint: ''
command: curl -sL -k -w "%{http_code}\\n" "http://scitran-core:8080/api" -o /dev/null
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment