Include py39 tests as part of zuul for this repo

The test_helm base unit test class was removed from sysinv,
as part of remove-armada-helmv2 work in March
so adding stub unit tests so tox will not report an
empty test run.

Unit tests are now validated by pylint.

Added in a .coveragerc file to show unit test coverage
for this component.

tox.ini is cleaned up since python3 is now the only
supported version of python. Removed py27 and py36.

Cleaned up some out of date entries in tox.ini

This change has no runtime impact.
This change only affects tox and zuul.

Test Plan:
  PASS: build-pkgs -c -p python3-k8sapp-rook
  PASS: tox

Related-Bug: #2024005
Change-Id: I9477ea3f6160d90f9410d01ece17795ef763f054
Signed-off-by: Al Bailey <al.bailey@windriver.com>
This commit is contained in:
Al Bailey 2023-06-17 18:48:01 +00:00 committed by Eric MacDonald
parent 0a6aecf0bd
commit 455c1921e7
5 changed files with 25 additions and 69 deletions

View File

@ -5,16 +5,14 @@
check:
jobs:
- openstack-tox-linters
# - k8sapp-rook-ceph-tox-py27
# - k8sapp-rook-ceph-tox-py39
- k8sapp-rook-ceph-tox-py39
- k8sapp-rook-ceph-tox-flake8
- k8sapp-rook-ceph-tox-pylint
- k8sapp-rook-ceph-tox-bandit
gate:
jobs:
- openstack-tox-linters
# - k8sapp-rook-ceph-tox-py27
# - k8sapp-rook-ceph-tox-py39
- k8sapp-rook-ceph-tox-py39
- k8sapp-rook-ceph-tox-flake8
- k8sapp-rook-ceph-tox-pylint
- k8sapp-rook-ceph-tox-bandit
@ -22,23 +20,6 @@
jobs:
- stx-rook-ceph-apps-upload-git-mirror
- job:
name: k8sapp-rook-ceph-tox-py27
parent: tox
description: |
Run py27 test for k8sapp_rook_ceph
nodeset: ubuntu-xenial
required-projects:
- starlingx/config
- starlingx/fault
- starlingx/update
- starlingx/utilities
files:
- python3-k8sapp-rook/*
vars:
tox_envlist: py27
tox_extra_args: -c python3-k8sapp-rook/k8sapp_rook/tox.ini
- job:
name: k8sapp-rook-ceph-tox-py39
parent: tox-py39
@ -63,7 +44,7 @@
parent: tox
description: |
Run flake8 test for k8sapp_rook_ceph
nodeset: ubuntu-focal
nodeset: debian-bullseye
files:
- python3-k8sapp-rook/*
vars:
@ -75,7 +56,7 @@
parent: tox
description: |
Run pylint test for k8sapp_rook_ceph
nodeset: ubuntu-focal
nodeset: debian-bullseye
required-projects:
- starlingx/config
- starlingx/fault
@ -92,7 +73,7 @@
parent: tox
description: |
Run bandit test for k8sapp_rook_ceph
nodeset: ubuntu-focal
nodeset: debian-bullseye
files:
- python3-k8sapp-rook/*
vars:

View File

@ -0,0 +1,7 @@
[run]
branch = True
source = k8sapp_rook
omit = k8sapp_rook/tests/*
[report]
ignore_errors = True

View File

@ -4,23 +4,26 @@
from sysinv.common import constants
from sysinv.tests.db import base as dbbase
from sysinv.tests.helm.test_helm import HelmOperatorTestSuiteMixin
class K8SAppRookAppMixin(object):
app_name = constants.HELM_APP_ROOK_CEPH
path_name = app_name + '.tgz'
def setUp(self):
def setUp(self): # pylint: disable=useless-super-delegation
super(K8SAppRookAppMixin, self).setUp()
def test_stub(self):
# This unit test stub should be removed when real
# unit tests are added
pass
# Test Configuration:
# - Controller
# - IPv6
class K8SAppRookControllerTestCase(K8SAppRookAppMixin,
dbbase.BaseIPv6Mixin,
HelmOperatorTestSuiteMixin,
dbbase.ControllerHostTestCase):
pass
@ -29,6 +32,5 @@ class K8SAppRookControllerTestCase(K8SAppRookAppMixin,
# - AIO
# - IPv4
class K8SAppRookAIOTestCase(K8SAppRookAppMixin,
HelmOperatorTestSuiteMixin,
dbbase.AIOSimplexHostTestCase):
pass

View File

@ -7,7 +7,7 @@ rcfile=pylint.rc
#init-hook=
# Add files or directories to the blacklist. Should be base names, not paths.
ignore=tests
ignore=
# Pickle collected data for later comparisons.
persistent=yes

View File

@ -1,6 +1,6 @@
[tox]
envlist = flake8,py27,py36,py39,pylint,bandit
minversion = 1.6
envlist = flake8,py39,pylint,bandit
minversion = 2.3
# skipsdist = True
#,pip-missing-reqs
@ -10,13 +10,9 @@ stxdir = {toxinidir}/../../..
distshare={toxworkdir}/.tox/distshare
[testenv]
# enabling usedevelop results in py27 develop-inst:
# Exception: Versioning for this project requires either an sdist tarball,
# or access to an upstream git repository.
# Note. site-packages is true and rpm-python must be yum installed on your dev machine.
usedevelop = True
basepython = python3
sitepackages = True
sitepackages = False
# tox is silly... these need to be separated by a newline....
allowlist_externals = bash
@ -24,8 +20,7 @@ allowlist_externals = bash
install_command = pip install \
-v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
# Note the hash seed is set to 0 until can be tested with a
@ -41,7 +36,6 @@ setenv = VIRTUAL_ENV={envdir}
TOX_WORK_DIR={toxworkdir}
PYLINTHOME={toxworkdir}
# for debian the path to cgcs-patch is incorrect
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
@ -49,7 +43,7 @@ deps = -r{toxinidir}/requirements.txt
-e{[tox]stxdir}/fault/fm-api/source
-e{[tox]stxdir}/fault/python-fmclient/fmclient
-e{[tox]stxdir}/utilities/ceph/python-cephclient/python-cephclient
-e{[tox]stxdir}/update/cgcs-patch/cgcs-patch
-e{[tox]stxdir}/update/sw-patch/cgcs-patch
commands =
find . -type f -name "*.pyc" -delete
@ -64,41 +58,18 @@ max-line-length=120
ignore = H104,H401
[testenv:flake8]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands =
flake8 {posargs} .
[testenv:py27]
basepython = python2.7
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py36]
basepython = python3.6
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:py39]
basepython = python3.9
sitepackages = False
install_command = pip install \
-v -v -v \
-c{toxinidir}/upper-constraints.txt \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
commands =
{[testenv]commands}
stestr run {posargs}
stestr slowest
[testenv:pep8]
# testenv:flake8 clone
basepython = {[testenv:flake8]basepython}
deps = {[testenv:flake8]deps}
commands = {[testenv:flake8]commands}
@ -109,20 +80,15 @@ commands = {posargs}
exclude = tests
[testenv:bandit]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = bandit --ini tox.ini -n 5 -r k8sapp_rook
[testenv:pylint]
basepython = python3
sitepackages = False
deps = {[testenv]deps}
commands =
pylint {posargs} k8sapp_rook --rcfile=./pylint.rc
[testenv:cover]
basepython = python2.7
deps = {[testenv]deps}
basepython = python3.9
setenv = {[testenv]setenv}
PYTHON=coverage run --parallel-mode