From 5405e9df717f2276b6e611a0aed3ed805d37d15f Mon Sep 17 00:00:00 2001 From: Giorgos Logiotatidis Date: Fri, 9 Oct 2015 10:05:48 +0300 Subject: [PATCH] Run units tests in docker pipeline. --- docker/docker-compose.yml | 16 ---------------- docker/jenkins/run_tests.sh | 25 ++++++++----------------- 2 files changed, 8 insertions(+), 33 deletions(-) delete mode 100644 docker/docker-compose.yml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 641acc40f5..0000000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,16 +0,0 @@ -db: - image: postgres:9.4 -web: - image: ${FROM_DOCKER_REPOSITORY}:${GIT_COMMIT} - ports: - - "8000:8000" - links: - - db - environment: - - PYTHONDONTWRITEBYTECODE=1 - - DATABASE_URL=postgres://postgres@db/postgres - - DEBUG=True - - ALLOWED_HOSTS=localhost,127.0.0.1, - - SECRET_KEY=39114b6a-2858-4caf-8878-482a24ee9542 - - DOCKER=True - command: ./docker/run-dev.sh diff --git a/docker/jenkins/run_tests.sh b/docker/jenkins/run_tests.sh index 1e1bf177c6..fb82698da1 100755 --- a/docker/jenkins/run_tests.sh +++ b/docker/jenkins/run_tests.sh @@ -4,21 +4,12 @@ # set -ex -# Create a temporary virtualenv to install docker-compose -TDIR=`mktemp -d` -virtualenv $TDIR -. $TDIR/bin/activate -pip install docker-compose==1.2.0 +ENV_FILE=`mktemp` +cat << EOF > $ENV_FILE +DEBUG=True +ALLOWED_HOSTS=localhost,127.0.0.1, +SECRET_KEY=39114b6a-2858-4caf-8878-482a24ee9542 +ADMINS=["thedude@example.com"] +EOF -cat docker/docker-compose.yml | envsubst > ./docker-compose.yml - -DOCKER_COMPOSE="docker-compose --project-name jenkins${JOB_NAME}${BUILD_NUMBER}" -# Start the database and give it some time to boot up -# TODO Uncomment when unit tests can run without locales. -## $DOCKER_COMPOSE up -d db -## sleep 10s; -## $DOCKER_COMPOSE run -T web ./manage.py test - -# Cleanup -$DOCKER_COMPOSE stop -rm -rf $TDIR +docker run --env-file $ENV_FILE ${DOCKER_REPOSITORY}:${GIT_COMMIT} ./manage.py test