mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-14 00:40:02 +08:00
Use a volume when running the unit tests instead of copying the source in the image
This commit is contained in:
47
docker/Dockerfile-tests
Normal file
47
docker/Dockerfile-tests
Normal file
@@ -0,0 +1,47 @@
|
||||
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 \
|
||||
git \
|
||||
kobo \
|
||||
kobo-rpmlib \
|
||||
libmodulemd \
|
||||
pdc-client \
|
||||
python-backports-ssl_match_hostname \
|
||||
python-dogpile-cache \
|
||||
python-enum34 \
|
||||
python-flask \
|
||||
python-flask-migrate \
|
||||
python-flask-sqlalchemy \
|
||||
python-funcsigs \
|
||||
python-futures \
|
||||
python-koji \
|
||||
python-ldap3 \
|
||||
python-mock \
|
||||
python-pip \
|
||||
python-requests \
|
||||
python-six \
|
||||
python-solv \
|
||||
python-sqlalchemy \
|
||||
# Test-only dependencies
|
||||
python-flake8 \
|
||||
python-mock \
|
||||
python-tox \
|
||||
rpm-build \
|
||||
&& yum clean all
|
||||
# We currently require a newer versions of these Python packages for the tests
|
||||
RUN pip install --upgrade flask-sqlalchemy pytest flake8 tox
|
||||
VOLUME /src
|
||||
WORKDIR /src
|
||||
CMD ["bash", "docker/test.sh"]
|
||||
16
docker/test.sh
Executable file
16
docker/test.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# We install the python-koji RPM but it doesn't register as installed through pip.
|
||||
# This hacks keeps tox from install koji from PyPi.
|
||||
cp requirements.txt requirements.txt.orig
|
||||
sed -i '/koji/d' requirements.txt
|
||||
# Delete any leftover compiled Python files
|
||||
for dir in module_build_service tests; do
|
||||
find ${dir} -type f \( -name '*.pyc' -or -name '*.pyc' \) -exec rm -f {} \;
|
||||
done
|
||||
# Since tox seems to ignore `usedevelop` when we have `sitepackages` on, we have to run it manually
|
||||
python setup.py develop
|
||||
/usr/bin/tox -e flake8,py27
|
||||
# After running tox, we can revert back to the original requirements.txt file
|
||||
rm -f requirements.txt
|
||||
mv requirements.txt.orig requirements.txt
|
||||
Reference in New Issue
Block a user