diff --git a/Dockerfile_tests b/Dockerfile_tests new file mode 100644 index 0000000..fd1164f --- /dev/null +++ b/Dockerfile_tests @@ -0,0 +1,19 @@ +ARG BASE_ROOT="nexus.iqser.com:5001/red/" +ARG VERSION_TAG="dev" + +FROM ${BASE_ROOT}pyinfra:${VERSION_TAG} + +EXPOSE 5000 +EXPOSE 8080 + +RUN python3 -m pip install coverage + +# Make a directory for the service files and copy the service repo into the container. +WORKDIR /app/service +COPY . . + +# Install module & dependencies +RUN python3 -m pip install -e . +RUN python3 -m pip install -r requirements.txt + +CMD coverage run -m pytest test/ -x && coverage report -m && coverage xml diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 0000000..8a5a58f --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,9 @@ +echo "${bamboo_nexus_password}" | docker login --username "${bamboo_nexus_user}" --password-stdin nexus.iqser.com:5001 +docker build -f Dockerfile_tests -t pyinfra-tests . + +rnd=$(date +"%s") +name=pyinfra-tests-${rnd} + +echo "running tests container" + +docker run --rm --net=host --name $name -v $PWD:$PWD -w $PWD -v /var/run/docker.sock:/var/run/docker.sock pyinfra-tests