mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-10 16:44:59 +08:00
This patch introduces a new environment variable in order to allow running
tests with different database backend. This is useful particularly for running
tests inside container. With this change, it is possible run tests in following
combinations:
* Python 2 and SQLite
* Python 3 and SQLite
* Python 2 and PostgreSQL
* Python 3 and PostgreSQL
Package python-psycopg2 is installed in both Dockerfile-tests and
Dockerfile-tests-py3 in case of running tests with PostgreSQL.
A new script contrib/run-unittests.sh is added to make it easy to run tests. An
example:
contrib/run-unittests.sh --py3 --with-pgsql
that runs tests with Python 3 and PostgreSQL.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
55 lines
1.4 KiB
Plaintext
55 lines
1.4 KiB
Plaintext
FROM centos:7
|
|
|
|
WORKDIR /build
|
|
RUN yum -y update
|
|
RUN yum -y install epel-release yum-utils
|
|
RUN yum-config-manager --add-repo https://kojipkgs.fedoraproject.org/repos-dist/epel7Server-infra/latest/x86_64/
|
|
RUN yum -y install \
|
|
--nogpgcheck \
|
|
--setopt=deltarpm=0 \
|
|
--setopt=install_weak_deps=false \
|
|
--setopt=tsflags=nodocs \
|
|
bash \
|
|
createrepo_c \
|
|
fedmsg \
|
|
fedmsg-hub \
|
|
gcc \
|
|
git \
|
|
kobo \
|
|
kobo-rpmlib \
|
|
python-backports-ssl_match_hostname \
|
|
python-dnf \
|
|
python-dogpile-cache \
|
|
python-enum34 \
|
|
python-flask \
|
|
python-flask-migrate \
|
|
python-flask-sqlalchemy \
|
|
python-funcsigs \
|
|
python-futures \
|
|
python-koji \
|
|
python-ldap3 \
|
|
python2-libmodulemd \
|
|
python-mock \
|
|
python-munch \
|
|
python-pip \
|
|
python-prometheus_client \
|
|
python-requests \
|
|
python-six \
|
|
python-solv \
|
|
python-sqlalchemy \
|
|
python2-pungi \
|
|
python-psycopg2 \
|
|
# Test-only dependencies
|
|
python-flake8 \
|
|
python-mock \
|
|
python-tox \
|
|
rpm-build \
|
|
python2-pyyaml \
|
|
&& yum clean all
|
|
# We currently require newer versions of these Python packages for the tests.
|
|
# more-itertools is required by pytest, but versions 6.0.0 and up aren't Python 2 compatible
|
|
RUN pip install --upgrade flask-sqlalchemy pytest flake8 tox pip "more-itertools<6.0.0"
|
|
VOLUME /src
|
|
WORKDIR /src
|
|
CMD ["bash", "docker/test.sh"]
|