From 72621277f3513afb87736a436469c64c70a6d911 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Oct 17 2019 15:13:55 +0000 Subject: Merge #1465 `run-unittests.sh: docker pull needed images` --- diff --git a/contrib/run-unittests.sh b/contrib/run-unittests.sh index d30df19..77f200e 100755 --- a/contrib/run-unittests.sh +++ b/contrib/run-unittests.sh @@ -10,6 +10,9 @@ # --py3: run tests inside mbs-test-fedora container with Python 3. If not # set, tests will run in mbs-test-centos with Python 2 by default. # --with-pgsql: run tests with PostgreSQL, otherwise SQLite is used. +# --no-tty: don't use tty for containers +# --sudo: run Docker via sudo +# --no-pull: don't update Docker images # # Please note that, both of them can have arbitrary value as long as one of # them is set. So, generally, it works by just setting to 1 or yes for @@ -19,6 +22,7 @@ enable_py3= with_pgsql= no_tty= use_sudo= +do_pull=1 while (( "$#" )); do case "$1" in @@ -26,6 +30,7 @@ while (( "$#" )); do --with-pgsql) with_pgsql=1 ;; --no-tty) no_tty=1 ;; --sudo) use_sudo=1 ;; + --no-pull) do_pull= ;; *) break ;; esac shift @@ -98,6 +103,7 @@ if [[ $tox_args == tests/* ]]; then tox_args="/root/mbs/src/${tox_args}" fi +[ -n "$do_pull" ] && $docker pull "$test_image" (cd "$source_dir" && $docker run "${container_opts[@]}" $test_image "$tox_args") rv=$? diff --git a/docs/CONTRIBUTING.rst b/docs/CONTRIBUTING.rst index 3dfb96d..94f1b48 100644 --- a/docs/CONTRIBUTING.rst +++ b/docs/CONTRIBUTING.rst @@ -29,6 +29,9 @@ There are options to change the tests enviornment: * ``--py3``: run tests with Python 3. * ``--with-pgsql``: run tests with PostgreSQL database. +* ``--no-tty``: don't use tty for containers +* ``--sudo``: run Docker via sudo +* ``--no-pull``: don't update Docker images For example, ``contrib/run-unittests.sh --py3 --with-pgsql``.