
Introduce lifecycle plugin for metrics-server to allow managing the application's behavior during different phases of its lifecycle. This is required to allow adding labels to the pods and restart them right after the application is applied, which is going to be implemented by a follow-up commit. Test Plan: PASS: build-pkgs -c -p python3-k8sapp-metrics-server PASS: build-pkgs -c -p stx-metrics-server-helm PASS: upload/apply/remove/delete/update metrics-server PASS: possible to access hooks like post-apply and post-remove Story: 2010962 Task: 49066 Change-Id: If2e334e238ac51795907b4c6076d7bebe3ce9739 Signed-off-by: David Barbosa Bastos <david.barbosabastos@windriver.com>
107 lines
2.9 KiB
INI
107 lines
2.9 KiB
INI
[tox]
|
|
envlist = flake8,py39,pylint,bandit,cover
|
|
minversion = 2.3
|
|
|
|
# tox does not work if the path to the workdir is too long, so move it to /tmp
|
|
toxworkdir = /tmp/{env:USER}_k8smstox
|
|
stxdir = {toxinidir}/../../..
|
|
distshare={toxworkdir}/.tox/distshare
|
|
|
|
[testenv]
|
|
allowlist_externals = bash
|
|
find
|
|
basepython = python3
|
|
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}
|
|
|
|
# Note the hash seed is set to 0 until can be tested with a
|
|
# random hash seed successfully.
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
PYTHONHASHSEED=0
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
OS_TEST_PATH=./k8sapp_metrics_server/tests
|
|
LANG=en_US.UTF-8
|
|
LANGUAGE=en_US:en
|
|
LC_ALL=C
|
|
EVENTS_YAML=./k8sapp_metrics_server/tests/events_for_testing.yaml
|
|
SYSINV_TEST_ENV=True
|
|
TOX_WORK_DIR={toxworkdir}
|
|
PYLINTHOME={toxworkdir}
|
|
|
|
# the path to cgcs-patch needs to be updated to sw-patch
|
|
deps = -r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
|
|
-e{[tox]stxdir}/config/tsconfig/tsconfig
|
|
-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/sw-patch/cgcs-patch
|
|
|
|
|
|
commands =
|
|
find . -type f -name "*.pyc" -delete
|
|
|
|
[flake8]
|
|
exclude = build,dist,tools,.eggs
|
|
max-line-length=120
|
|
|
|
[testenv:flake8]
|
|
basepython = python3
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands =
|
|
flake8 {posargs} .
|
|
|
|
[testenv:py39]
|
|
basepython = python3.9
|
|
commands =
|
|
{[testenv]commands}
|
|
stestr run {posargs}
|
|
stestr slowest
|
|
|
|
[testenv:pep8]
|
|
deps = {[testenv:flake8]deps}
|
|
commands = {[testenv:flake8]commands}
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[bandit]
|
|
# Add bandit configuration here
|
|
|
|
[testenv:bandit]
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = bandit --ini tox.ini -n 5 -r k8sapp_metrics_server
|
|
|
|
[testenv:pylint]
|
|
deps = {[testenv]deps}
|
|
commands =
|
|
pylint {posargs} k8sapp_metrics_server --rcfile=./pylint.rc
|
|
|
|
[testenv:cover]
|
|
deps = {[testenv]deps}
|
|
setenv = {[testenv]setenv}
|
|
PYTHON=coverage run --parallel-mode
|
|
|
|
commands =
|
|
{[testenv]commands}
|
|
coverage erase
|
|
stestr run {posargs}
|
|
coverage combine
|
|
coverage html -d cover
|
|
coverage xml -o cover/coverage.xml
|
|
coverage report
|
|
|
|
[testenv:pip-missing-reqs]
|
|
# do not install test-requirements as that will pollute the virtualenv for
|
|
# determining missing packages
|
|
# this also means that pip-missing-reqs must be installed separately, outside
|
|
# of the requirements.txt files
|
|
deps = pip_missing_reqs
|
|
-rrequirements.txt
|
|
commands=pip-missing-reqs -d --ignore-file=/k8sapp_metrics_server/tests k8sapp_metrics_server
|