diff --git a/Dockerfile b/Dockerfile index 65865f4464be686fed8199efc709f3bd93244c33..06450901e9b695208906b296f1ba521d3497bd18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,6 +67,9 @@ RUN pip install --upgrade pip wheel setuptools \ && pip install -r /var/scitran/code/api/requirements-docker.txt \ && pip install -r /var/scitran/code/api/requirements.txt +COPY test /var/scitran/code/api/test/ +RUN bash -e -x /var/scitran/code/api/test/bin/setup-integration-tests-ubuntu.sh + # Copy full repo # diff --git a/TESTING.md b/TESTING.md index 73184457cdc8999e98b6e4d78f803f39ec12d653..2a581f0806f073f4cc790b776838a3428de7d8d5 100644 --- a/TESTING.md +++ b/TESTING.md @@ -12,6 +12,32 @@ ./test/bin/run-tests-ubuntu.sh ``` +### Docker +``` +# Execute this from the root of this repository + +# Build the docker image +docker build -t scitran-core . + +# Launch Mongo isinstance +docker run --name some-mongo -d mongo + +# Execute tests +docker run \ + --rm \ + --name scitran-core-tester \ + -e "SCITRAN_PERSISTENT_DB_URI=mongodb://some-mongo:27017/scitran" \ + --link some-mongo \ + -v $(pwd):/var/scitran/code/api \ + --entrypoint bash \ + scitran-core \ + /var/scitran/code/api/test/bin/run-tests-ubuntu.sh + +# Stop and remove mongo container +docker rm -v -f some-mongo + +``` + ### Tools - [abao](https://github.com/cybertk/abao/) - [postman](https://www.getpostman.com/docs/) diff --git a/test/Dockerfile b/test/Dockerfile deleted file mode 100644 index 1419ed47a111adc368e2d7497b8fe024f5993632..0000000000000000000000000000000000000000 --- a/test/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM python:2.7 - -ENV MONGO_PATH='mongodb://mongo:27017/scitran' -ENV BASE_URL='http://scitran-core:8080/api' - -VOLUME /usr/src/tests -WORKDIR /usr/src/tests - -COPY integration_tests/requirements-integration-test.txt requirements.txt -RUN pip install -r requirements.txt - -# Install node for testing tools -# We need node >= 4.0 for newman so install from node-source repo -# Need to install apt support for https to access these urls -RUN apt-get update && apt-get install -y apt-transport-https -RUN curl --silent https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - -RUN echo "deb https://deb.nodesource.com/node_5.x trusty main" | tee /etc/apt/sources.list.d/nodesource.list -RUN echo "deb-src https://deb.nodesource.com/node_5.x trusty main" | tee -a /etc/apt/sources.list.d/nodesource.list -RUN apt-get update && apt-get -y install nodejs - -# Install newman for running postman collection tests from CLI -RUN npm install -g /usr/src/tests - -ENTRYPOINT ["py.test"]