Allow to run specific test inside container

For example, contrib/run-unittests.sh /src/tests/test_utils ...

Please note that the path starts from /src, which is the root directory of
code inside container.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
Chenxiong Qi
2019-06-21 21:40:54 +08:00
committed by mprahl
parent 567a05b09c
commit 5f93a47051
5 changed files with 17 additions and 6 deletions

View File

@@ -19,12 +19,14 @@ enable_py3=
with_pgsql=
no_tty=
for arg in "$@"; do
case $arg in
while (( "$#" )); do
case "$1" in
--py3) enable_py3=1 ;;
--with-pgsql) with_pgsql=1 ;;
--no-tty) no_tty=1 ;;
*) break ;;
esac
shift
done
image_ns=quay.io/factory2
@@ -64,7 +66,7 @@ if [ -n "$with_pgsql" ]; then
)
fi
(cd "$source_dir" && docker run "${container_opts[@]}" $test_image)
(cd "$source_dir" && docker run "${container_opts[@]}" $test_image "$@")
rv=$?

View File

@@ -51,4 +51,4 @@ RUN yum -y install \
RUN pip install --upgrade flask-sqlalchemy pytest flake8 tox pip "more-itertools<6.0.0"
VOLUME /src
WORKDIR /src
CMD ["bash", "docker/test.sh"]
ENTRYPOINT ["docker/test.sh"]

View File

@@ -39,4 +39,4 @@ RUN dnf -y install \
&& dnf clean all
VOLUME /src
WORKDIR /src
CMD ["bash", "docker/test-py3.sh"]
ENTRYPOINT ["docker/test-py3.sh"]

View File

@@ -13,7 +13,7 @@ done
rm -f /usr/lib/python2.7/site-packages/virtualenv_support/pip-9*
# Since tox seems to ignore `usedevelop` when we have `sitepackages` on, we have to run it manually
python setup.py develop --no-deps
/usr/bin/tox -e flake8,py27
/usr/bin/tox -e flake8,py27 "$@"
rv=$?
# After running tox, we can revert back to the original requirements.txt file
rm -f requirements.txt

View File

@@ -29,6 +29,15 @@ There are options to change the tests enviornment:
For example, ``contrib/run-unittests.sh --py3 --with-pgsql``.
You can specify the subset of tests to run inside the container as well. Tests
specified from command-line are passed to ``py.test`` directly. Please note that,
the path of each test must start with ``/src/``. For example::
contrib/run-unittests.sh \
/src/tests/test_utils/ \
/src/tests/test_mmd_resolver.py \
/src/tests/test_builder/test_koji.py::TestKojiBuilder::test_tag_to_repo
Style Guide
===========