From 030d248eacb9dc2c1d705163942be02b8bc81844 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Tue, 22 Sep 2015 21:32:53 +0000 Subject: [PATCH] run tests inside docker as same user from outside docker, to avoid problems with --volume --- tests/run-tests.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 5af4022..3e482f8 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -4,12 +4,17 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" docker build -t internetarchive/rethinkdb $script_dir || exit 1 +uid=$(id -u) +user=$(id -un) + for python in python2.7 python3.4 do docker run --rm -i -t --volume="$script_dir/..:/rethinkstuff" internetarchive/rethinkdb /sbin/my_init -- \ - bash -c "cd /rethinkstuff && virtualenv -p $python /tmp/venv \ - && source /tmp/venv/bin/activate \ - && pip install pytest . \ - && py.test -v -s tests" + bash -x -c "adduser --gecos=$user --disabled-password --quiet --uid=$uid $user \ + && sudo -u $user bash -x -c 'cd /rethinkstuff \ + && virtualenv -p $python /tmp/venv \ + && source /tmp/venv/bin/activate \ + && pip install pytest . \ + && py.test -v -s tests'" done