From df31068c804e4c854c412144203ed5b1c3acb6fa Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Wed, 18 Nov 2015 01:59:32 +0000 Subject: [PATCH] improve test running script --- tests/run-tests.sh | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 680f549..86e2a7e 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -1,24 +1,29 @@ #!/bin/bash - -script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -docker build -t internetarchive/warcprox-tests $script_dir || exit 1 - -uid=$(id -u) -user=$(id -un) +# +# Runs tests in a docker container. Also runs a temporary instance of rethinkdb +# inside the container. The tests run with rethinkdb features enabled, against +# that instance of rethinkdb, and also run without rethinkdb features enabled. +# With python 2.7 and 3.4. +# +# 😬 +# set -e +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +docker build -t internetarchive/warcprox-tests $script_dir + for python in python2.7 python3.4 do - docker run --rm -i -t --volume="$script_dir/..:/warcprox" internetarchive/warcprox-tests /sbin/my_init -- \ - bash -x -c " adduser --gecos=$user --disabled-password --quiet --uid=$uid $user \ - && sudo PYTHONDONTWRITEBYTECODE=1 -u $user bash -x -c 'cd /warcprox \ - && virtualenv -p $python /tmp/venv \ - && source /tmp/venv/bin/activate \ - && pip --log-file /tmp/pip.log install . pytest requests \ - && py.test -s tests \ - && py.test -s --rethinkdb-servers=localhost tests \ - && py.test -s --rethinkdb-servers=localhost --rethinkdb-big-table tests'" + docker run --rm --volume="$script_dir/..:/warcprox" internetarchive/warcprox-tests /sbin/my_init -- \ + bash -x -c "cd /tmp && git clone /warcprox && cd /tmp/warcprox \ + && (cd /warcprox && git diff) | patch -p1 \ + && virtualenv -p $python /tmp/venv \ + && source /tmp/venv/bin/activate \ + && pip --log-file /tmp/pip.log install . pytest requests \ + && py.test -s tests \ + && py.test -s --rethinkdb-servers=localhost tests \ + && py.test -s --rethinkdb-servers=localhost --rethinkdb-big-table tests" done