improve test running script

This commit is contained in:
Noah Levitt 2015-11-18 01:59:32 +00:00
parent 4bb7e043d4
commit df31068c80

View File

@ -1,24 +1,29 @@
#!/bin/bash #!/bin/bash
#
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Runs tests in a docker container. Also runs a temporary instance of rethinkdb
# inside the container. The tests run with rethinkdb features enabled, against
docker build -t internetarchive/warcprox-tests $script_dir || exit 1 # that instance of rethinkdb, and also run without rethinkdb features enabled.
# With python 2.7 and 3.4.
uid=$(id -u) #
user=$(id -un) # 😬
#
set -e 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 for python in python2.7 python3.4
do do
docker run --rm -i -t --volume="$script_dir/..:/warcprox" internetarchive/warcprox-tests /sbin/my_init -- \ docker run --rm --volume="$script_dir/..:/warcprox" internetarchive/warcprox-tests /sbin/my_init -- \
bash -x -c " adduser --gecos=$user --disabled-password --quiet --uid=$uid $user \ bash -x -c "cd /tmp && git clone /warcprox && cd /tmp/warcprox \
&& sudo PYTHONDONTWRITEBYTECODE=1 -u $user bash -x -c 'cd /warcprox \ && (cd /warcprox && git diff) | patch -p1 \
&& virtualenv -p $python /tmp/venv \ && virtualenv -p $python /tmp/venv \
&& source /tmp/venv/bin/activate \ && source /tmp/venv/bin/activate \
&& pip --log-file /tmp/pip.log install . pytest requests \ && pip --log-file /tmp/pip.log install . pytest requests \
&& py.test -s tests \ && py.test -s tests \
&& py.test -s --rethinkdb-servers=localhost tests \ && py.test -s --rethinkdb-servers=localhost tests \
&& py.test -s --rethinkdb-servers=localhost --rethinkdb-big-table tests'" && py.test -s --rethinkdb-servers=localhost --rethinkdb-big-table tests"
done done