#438 Jenkins unittests run in docker container
Merged 2 years ago by onosek. Opened 2 years ago by onosek.
onosek/fedpkg jenkins_docker  into  master

file modified
+1 -1
@@ -5,5 +5,5 @@ 

  tox:

  	@python3 -m venv .env

  	@.env/bin/pip install tox

- 	@.env/bin/tox -e py27,py36,py37,flake8,flake8python2 --parallel=auto ${TOX_POSARGS}

+ 	@.env/bin/tox -e py27,py36,py39,flake8,flake8python2 --parallel=auto ${TOX_POSARGS}

  .PHONY: tox

@@ -0,0 +1,24 @@ 

+ FROM fedora:33

+ LABEL \

+     name="fedpkg test" \

+     description="Run tests using tox with Python 3" \

+     vendor="fedpkg developers" \

+     license="MIT"

+ 

+ RUN dnf -y update && dnf -y install \

+         python3-setuptools \

+         rpm-build \

+         python3-tox \

+         gcc \

+         libcurl-devel \

+         krb5-devel \

+         openssl-devel \

+         make \

+         git

+ RUN dnf clean all

+ 

+ WORKDIR /src

+ 

+ ENV PYTHONPATH "${PYTHONPATH}:./rpkg"

+ 

+ CMD ["tox", "-e", "py36,py39,flake8"]

@@ -0,0 +1,32 @@ 

+ FROM centos:7

+ LABEL \

+     name="fedpkg test for Python 2" \

+     description="Run tests using tox with Python 2" \

+     vendor="fedpkg developers" \

+     license="MIT"

+ 

+ RUN yum -y update && yum install -y epel-release

+ RUN yum -y install \

+         pytest \

+         python2-six \

+         python2-mock \

+         git \

+         GitPython \

+         python-requests \

+         PyYAML \

+         python2-cccolutils \

+         python2-koji \

+         python2-bugzilla \

+         python2-freezegun \

+         bodhi-client \

+         python-flake8 \

+         python2-fedora \

+         python2-distro \

+         rpm-build

+ RUN yum clean all

+ 

+ WORKDIR /src

+ 

+ ENV PYTHONPATH "${PYTHONPATH}:./rpkg"

+ 

+ CMD ["python", "-m", "pytest" ,"test"]

file modified
+1
@@ -1,3 +1,4 @@ 

+ bodhi-client

  openidc-client

  python-bugzilla

  rpkg

file modified
+6 -11
@@ -1831,8 +1831,7 @@ 

          override_expiration_date = utcnow + timedelta(days=7)

          build_nvr = 'somepkg-1.54-2.fc28'

          build_override = {

-             'expiration_date':

-                 override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

+             'expiration_date': override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

              'nvr': build_nvr,

              'notes': 'build for other package',

              'build': {'nvr': build_nvr},
@@ -1886,8 +1885,7 @@ 

          override_expiration_date = utcnow + timedelta(days=7)

          build_nvr = 'somepkg-1.54-2.fc28'

          build_override = {

-             'expiration_date':

-                 override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

+             'expiration_date': override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

              'nvr': build_nvr,

              'notes': 'build for other package',

              'build': {'nvr': build_nvr},
@@ -1946,8 +1944,7 @@ 

          override_expiration_date = utcnow - timedelta(days=7)

          build_nvr = 'somepkg-1.54-2.fc28'

          build_override = {

-             'expiration_date':

-                 override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

+             'expiration_date': override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

              'nvr': build_nvr,

              'notes': 'build for other package',

              'build': {'nvr': build_nvr},
@@ -2008,8 +2005,7 @@ 

          list_overrides.return_value = {

              'total': 1,

              'overrides': [{

-                 'expiration_date':

-                     override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

+                 'expiration_date': override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

                  'nvr': build_nvr,

                  'notes': 'build for other package',

                  'build': {'nvr': build_nvr},
@@ -2043,8 +2039,7 @@ 

  

          build_nvr = 'somepkg-1.54-2.fc28'

          build_override = {

-             'expiration_date':

-                 override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

+             'expiration_date': override_expiration_date.strftime('%Y-%m-%d %H:%M:%S'),

              'nvr': build_nvr,

              'notes': 'build for other package',

              'build': {'nvr': build_nvr},
@@ -2326,7 +2321,7 @@ 

         return_value={

             'epel': ['el6', 'epel7'],

             'fedora': ['f29', 'f28']

-         })

+        })

  class TestReleasesInfo(CliTestCase):

      """Test command releases-info"""

  

file modified
+6 -5
@@ -273,11 +273,12 @@ 

          ]

          get.return_value = rv

  

-         utils.verify_sls('http://localhost/',

-                          {

-                             'bug_fixes': '2018-06-01',

-                             'security_fixes': '2018-12-01'

-                          })

+         utils.verify_sls(

+             'http://localhost/',

+             {

+                 'bug_fixes': '2018-06-01',

+                 'security_fixes': '2018-12-01'

+             })

  

  

  @patch('requests.get')

file modified
+5 -8
@@ -1,13 +1,13 @@ 

  [tox]

- envlist = py27,py36,py37,flake8

+ envlist = py27,py36,py39,flake8

  

  [testenv]

- sitepackages=False

+ sitepackages=false

  basepython=

      py27: {env:TOXPYTHON:python2.7}

      py36: {env:TOXPYTHON:python3.6}

-     py37: {env:TOXPYTHON:python3.7}

-     flake8: {env:TOXPYTHON:python3.7}

+     py39: {env:TOXPYTHON:python3.9}

+     flake8: {env:TOXPYTHON:python3.6}

      flake8python2: {env:TOXPYTHON:python2.7}

  deps =

      -r{toxinidir}/requirements.txt
@@ -28,8 +28,5 @@ 

  commands = python -m flake8 fedpkg/ test/

  

  [testenv:flake8python2]

- deps =

-     -r{toxinidir}/requirements-py2.txt

-     -r{toxinidir}/tests-requirements.txt

-     flake8

+ deps = flake8

  commands = python -m flake8 fedpkg/ test/

Prepared dockerfiles for creating a testing environment in containers.
Two containers are prepared. The first for normal Python3 and the second one runs in CentOS 7.
A tox configuration is customized for supported versions of Python.

JIRA: RHELCMP-4962

Sorry, I didn't mention that Jenkins for py2 needs to be fixed. Will do that later today.

rebased onto f358b9db707c1d19677cd0095596c0e174b9f7cc

2 years ago

rebased onto c772db8

2 years ago

Pull-Request has been merged by onosek

2 years ago