2013-05-02 18:50:57 +00:00
|
|
|
[tox]
|
2024-02-12 13:54:38 +00:00
|
|
|
minversion = 4.4.0
|
2019-11-20 14:52:10 +00:00
|
|
|
envlist = py3,pep8
|
2013-05-02 18:50:57 +00:00
|
|
|
|
|
|
|
[testenv]
|
2024-02-12 13:54:38 +00:00
|
|
|
constrain_package_deps = true
|
2013-09-30 14:55:00 +00:00
|
|
|
usedevelop = True
|
2013-05-02 18:50:57 +00:00
|
|
|
setenv = VIRTUAL_ENV={envdir}
|
2022-12-15 17:29:38 +00:00
|
|
|
PYTHONDONTWRITEBYTECODE=1
|
2015-03-13 15:42:51 +00:00
|
|
|
LANGUAGE=en_US
|
2015-09-30 16:39:46 +00:00
|
|
|
LC_ALL=en_US.UTF-8
|
2023-06-30 12:37:53 +00:00
|
|
|
BASE_TEST_TIMEOUT={env:BASE_TEST_TIMEOUT:60}
|
|
|
|
MIGRATIONS_TIMEOUT={env:MIGRATIONS_TIMEOUT:180}
|
2023-06-06 16:07:23 +00:00
|
|
|
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
|
|
|
|
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
|
|
|
|
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
|
Phase 1 - SQLAlchemy 2.0 Compatability
One of the major changes in SQLAlchemy 2.0 is the removal
of autocommit support. It turns out Ironic was using this quite
aggressively without even really being aware of it.
* Moved the declaritive_base to ORM, as noted in the SQLAlchemy 2.0
changes[0].
* Console testing caused us to become aware of issues around locking
where session synchronization, when autocommit was enabled, was
defaulted to False. The result of this is that you could have two
sessions have different results, which could results on different
threads, and where one could still attempt to lock based upon prior
information. Inherently, while this basically worked, it was
also sort of broken behavior. This resulted in locking being
rewritten to use the style mandated in SQLAlchemy 2.0 migration
documentation. This ultimately is due to locking, which is *heavily*
relied upon in Ironic, and in unit testing with sqlite, there are
no transactions, which means we can get some data inconsistency
in unit testing as well if we're reliant upon the database to
precisely and exactly return what we committed.[1]
* Begins changing the query.one()/query.all() style to use explicit
select statements as part of the new style mandated for migration
to SQLAlchemy 2.0.
* Instead of using field label strings for joined queries, use the
object format, which makes much more sense now, and is part of
the items required for eventual migration to 2.0.
* DB queries involving Traits are now loaded using SelectInLoad
as opposed to Joins. The now deprecated ORM queries were quietly
and silently de-duplicating rows and providing consistent sets
from the resulting joined table responses, however putting much
higher CPU load on the processing of results on the client.
Prior performance testing has informed us this should be a minimal
overhead impact, however these queries should no longer be in
transactions with the Database Servers which should offset the
shift in load pattern. The reason we cannot continue to deduplicate
locally in our code is because we carry Dict data sets which cannot
be hashed for deduplication. Most projects have handled this by
treating them as Text and then converting, but without a massive
rewrite, this seems to be the viable middle ground.
* Adds an explict mapping for traits and tags on the Node object
to point directly to the NodeTrait and NodeTag classes. This
superceeds the prior usage of a backref to make the association.
* Splits SQLAlchemy class model Node into Node and NodeBase, which
allows for high performance queries to skip querying for ``tags``
and ``traits``. Otherwise with the afrormentioned lookups would
always execute as they are now properties as well on the Node
class. This more common of a SQLAlchemy model, but Ironic's model
has been a bit more rigid to date.
* Adds a ``start_consoles`` and ``start_allocations`` option to the
conductor ``init_host`` method. This allows unit tests to be
executed and launched with the service context, while *not* also
creating race conditions which resulted in failed tests.
* The db API ``_paginate_query`` wrapper now contains additional
logic to handle traditional ORM query responses and the newer style
of unified query responses. Due to differences in queries and handling,
which also was part of the driver for the creation of ``NodeBase``,
as SQLAlchemy will only create an object if a base object is referenced.
Also, by default, everything returned is a tuple in 1.4 with the
unified interface.
* Also modified one unit test which counted time.sleep calls, which is
a known pattern which can create failures which are ultimately noise.
Ultimately, I have labelled the remaining places which SQLAlchemy
warnings are raised at for deprecation/removal of functionality,
which needs to be addressed.
[0] https://docs.sqlalchemy.org/en/14/changelog/migration_20.html
[1] https://docs.sqlalchemy.org/en/14/dialects/sqlite.html#transaction-isolation-level-autocommit
Change-Id: Ie0f4b8a814eaef1e852088d12d33ce1eab408e23
2022-09-07 16:58:57 +00:00
|
|
|
PYTHONUNBUFFERED=1
|
2018-07-06 14:24:01 +00:00
|
|
|
deps =
|
2020-10-30 05:50:47 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2018-07-06 14:24:01 +00:00
|
|
|
-r{toxinidir}/requirements.txt
|
|
|
|
-r{toxinidir}/test-requirements.txt
|
2017-06-13 14:30:19 +00:00
|
|
|
commands =
|
Unit tests: Isolate mysql test migrations
All database migration testing in opestack is done through
an opportunistic worker model, where if the database is available
and correctly configured for testing, i.e. openstack-citest user
and access appropriately granted, then the tests will create and
test migrations.
However, this has been problematic with mysql as of recent, as we
have seen a long standing migration issue boil to the surface often
with tests.
As a result, we're isolating that test down to it's own job so we
can limit the blast damage. This also helps us isolate is it all
of the tests, or is it just soley isolated down to the mysql test
run class, which is an additional data point.
By default, we continue to run Postgres migration tests in the
main jobs, as they haven't been impacted by this issue.
Change-Id: Iefc044c31ef029e400a7dad294504175a4462638
2023-06-29 16:13:18 +00:00
|
|
|
stestr run --slowest --parallel-class --exclude-regex TestMigrationsMySQL {posargs}
|
2022-12-15 17:29:38 +00:00
|
|
|
passenv = http_proxy
|
|
|
|
HTTP_PROXY
|
|
|
|
https_proxy
|
|
|
|
HTTPS_PROXY
|
|
|
|
no_proxy
|
|
|
|
NO_PROXY
|
2014-03-31 18:42:46 +00:00
|
|
|
|
2020-02-27 15:40:05 +00:00
|
|
|
[testenv:unit-with-driver-libs]
|
2019-03-08 11:13:19 +00:00
|
|
|
deps = {[testenv]deps}
|
|
|
|
-r{toxinidir}/driver-requirements.txt
|
|
|
|
|
2015-04-27 18:00:29 +00:00
|
|
|
[testenv:genstates]
|
2023-03-30 16:07:40 +00:00
|
|
|
allowlist_externals = {toxinidir}/tools/states_to_dot.py
|
2015-04-27 18:00:29 +00:00
|
|
|
deps = {[testenv]deps}
|
2024-05-10 21:31:55 +00:00
|
|
|
pydot
|
2015-06-03 23:56:08 +00:00
|
|
|
commands = {toxinidir}/tools/states_to_dot.py -f {toxinidir}/doc/source/images/states.svg --format svg
|
2015-04-27 18:00:29 +00:00
|
|
|
|
2013-05-02 18:50:57 +00:00
|
|
|
[testenv:pep8]
|
2020-12-14 13:00:25 +00:00
|
|
|
usedevelop = False
|
2020-12-08 20:20:20 +00:00
|
|
|
deps=
|
2023-12-28 22:23:05 +00:00
|
|
|
hacking~=6.1.0 # Apache-2.0
|
|
|
|
doc8~=1.1.0 # Apache-2.0
|
2021-07-28 09:33:15 +00:00
|
|
|
pycodestyle>=2.0.0,<3.0.0 # MIT
|
2023-12-28 22:23:05 +00:00
|
|
|
flake8-import-order~=0.18.0 # LGPLv3
|
|
|
|
bashate~=2.1.0 # Apache-2.0
|
2024-02-12 13:54:38 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2021-05-18 09:13:22 +00:00
|
|
|
allowlist_externals = bash
|
2022-12-28 13:49:46 +00:00
|
|
|
{toxinidir}/tools/run_bashate.sh
|
|
|
|
{toxinidir}/tools/check-releasenotes.py
|
2013-05-02 18:50:57 +00:00
|
|
|
commands =
|
2015-12-22 07:46:46 +00:00
|
|
|
bash tools/flake8wrap.sh {posargs}
|
2015-12-17 17:45:30 +00:00
|
|
|
# Run bashate during pep8 runs to ensure violations are caught by
|
|
|
|
# the check and gate queues.
|
2016-09-21 16:02:08 +00:00
|
|
|
{toxinidir}/tools/run_bashate.sh {toxinidir}
|
2016-01-27 10:36:33 +00:00
|
|
|
# Check the *.rst files
|
2023-02-23 17:38:19 +00:00
|
|
|
doc8 README.rst CONTRIBUTING.rst doc/source api-ref/source --ignore D001
|
2018-02-22 19:01:21 +00:00
|
|
|
# Check to make sure reno releasenotes created with 'reno new'
|
|
|
|
{toxinidir}/tools/check-releasenotes.py
|
2013-05-02 18:50:57 +00:00
|
|
|
|
|
|
|
[testenv:cover]
|
2023-06-07 15:31:26 +00:00
|
|
|
setenv = {[testenv]setenv}
|
2024-02-02 14:17:12 +00:00
|
|
|
PYTHON=coverage run --source ironic --parallel-mode
|
2013-05-02 18:50:57 +00:00
|
|
|
commands =
|
2016-04-17 16:59:30 +00:00
|
|
|
coverage erase
|
2023-06-28 13:29:53 +00:00
|
|
|
stestr run --parallel-class {posargs}
|
2017-09-19 12:34:01 +00:00
|
|
|
coverage combine
|
2024-02-02 14:17:12 +00:00
|
|
|
coverage report
|
|
|
|
coverage html -d ./cover
|
2013-05-02 18:50:57 +00:00
|
|
|
|
2014-06-20 17:53:17 +00:00
|
|
|
[testenv:genconfig]
|
2014-09-29 22:59:36 +00:00
|
|
|
sitepackages = False
|
2014-06-20 17:53:17 +00:00
|
|
|
commands =
|
2015-11-19 06:50:38 +00:00
|
|
|
oslo-config-generator --config-file=tools/config/ironic-config-generator.conf
|
2014-06-20 17:53:17 +00:00
|
|
|
|
2016-06-03 22:43:12 +00:00
|
|
|
[testenv:genpolicy]
|
|
|
|
sitepackages = False
|
|
|
|
commands =
|
2017-07-25 08:00:59 +00:00
|
|
|
oslopolicy-sample-generator --config-file=tools/policy/ironic-policy-generator.conf
|
2016-06-03 22:43:12 +00:00
|
|
|
|
Unit tests: Isolate mysql test migrations
All database migration testing in opestack is done through
an opportunistic worker model, where if the database is available
and correctly configured for testing, i.e. openstack-citest user
and access appropriately granted, then the tests will create and
test migrations.
However, this has been problematic with mysql as of recent, as we
have seen a long standing migration issue boil to the surface often
with tests.
As a result, we're isolating that test down to it's own job so we
can limit the blast damage. This also helps us isolate is it all
of the tests, or is it just soley isolated down to the mysql test
run class, which is an additional data point.
By default, we continue to run Postgres migration tests in the
main jobs, as they haven't been impacted by this issue.
Change-Id: Iefc044c31ef029e400a7dad294504175a4462638
2023-06-29 16:13:18 +00:00
|
|
|
[testenv:mysql-migrations]
|
|
|
|
sitepackages = False
|
|
|
|
commands =
|
|
|
|
stestr run --slowest --parallel-class TestMigrationsMySQL {posargs}
|
|
|
|
|
2016-06-03 09:21:33 +00:00
|
|
|
[testenv:debug]
|
|
|
|
commands = oslo_debug_helper -t ironic/tests/unit {posargs}
|
|
|
|
|
2015-05-20 14:36:35 +00:00
|
|
|
[testenv:docs]
|
2020-12-14 13:00:25 +00:00
|
|
|
# NOTE(dtantsur): documentation building process requires importing ironic
|
2018-03-15 16:35:19 +00:00
|
|
|
deps =
|
2020-10-30 05:50:47 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2020-12-14 13:00:25 +00:00
|
|
|
-r{toxinidir}/requirements.txt
|
2018-03-15 16:35:19 +00:00
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2023-03-30 16:07:40 +00:00
|
|
|
commands = sphinx-build -b html doc/source doc/build/html
|
2014-11-14 17:14:19 +00:00
|
|
|
|
2019-09-06 03:57:18 +00:00
|
|
|
[testenv:pdf-docs]
|
2021-05-18 09:13:22 +00:00
|
|
|
allowlist_externals = make
|
2019-09-06 03:57:18 +00:00
|
|
|
deps = {[testenv:docs]deps}
|
|
|
|
commands =
|
2024-08-30 17:49:38 +00:00
|
|
|
sphinx-build -b latex doc/source doc/build/pdf
|
2019-09-06 03:57:18 +00:00
|
|
|
make -C doc/build/pdf
|
|
|
|
|
|
|
|
|
2016-05-03 17:24:10 +00:00
|
|
|
[testenv:api-ref]
|
2022-02-01 00:12:37 +00:00
|
|
|
# NOTE(Mahnoor): documentation building process requires importing ironic API modules
|
2020-12-14 13:00:25 +00:00
|
|
|
usedevelop = False
|
2018-03-15 16:35:19 +00:00
|
|
|
deps =
|
2020-10-30 05:50:47 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2022-02-01 00:12:37 +00:00
|
|
|
-r{toxinidir}/requirements.txt
|
2018-03-15 16:35:19 +00:00
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2021-05-18 09:13:22 +00:00
|
|
|
allowlist_externals = bash
|
2016-05-03 17:24:10 +00:00
|
|
|
commands =
|
2016-05-16 12:18:26 +00:00
|
|
|
bash -c 'rm -rf api-ref/build'
|
2016-05-03 17:24:10 +00:00
|
|
|
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
|
|
|
|
|
2015-11-05 16:29:42 +00:00
|
|
|
[testenv:releasenotes]
|
2020-12-14 13:00:25 +00:00
|
|
|
usedevelop = False
|
2018-03-15 16:35:19 +00:00
|
|
|
deps =
|
2020-10-30 05:50:47 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2018-03-15 16:35:19 +00:00
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2017-04-05 21:49:42 +00:00
|
|
|
commands =
|
|
|
|
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
2015-11-05 16:29:42 +00:00
|
|
|
|
2013-05-02 18:50:57 +00:00
|
|
|
[testenv:venv]
|
2014-08-25 19:48:10 +00:00
|
|
|
setenv = PYTHONHASHSEED=0
|
2018-04-19 02:45:42 +00:00
|
|
|
deps =
|
2020-10-30 05:50:47 +00:00
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
2018-04-19 02:45:42 +00:00
|
|
|
-r{toxinidir}/test-requirements.txt
|
|
|
|
-r{toxinidir}/doc/requirements.txt
|
2013-05-02 18:50:57 +00:00
|
|
|
commands = {posargs}
|
|
|
|
|
|
|
|
[flake8]
|
2020-05-12 10:02:32 +00:00
|
|
|
# [E129] visually indented line with same indent as next logical line
|
|
|
|
# [E741] ambiguous variable name
|
2018-04-10 23:48:00 +00:00
|
|
|
# [W503] Line break before binary operator.
|
2020-05-12 10:02:32 +00:00
|
|
|
ignore = E129,E741,W503
|
2017-11-28 08:25:04 +00:00
|
|
|
filename = *.py,app.wsgi
|
2023-03-28 16:11:35 +00:00
|
|
|
exclude=.*,dist,doc,*lib/python*,*egg,build
|
2017-02-16 17:35:28 +00:00
|
|
|
import-order-style = pep8
|
2017-03-16 14:20:35 +00:00
|
|
|
application-import-names = ironic
|
2021-03-02 23:42:19 +00:00
|
|
|
max-complexity=19
|
2018-02-26 05:56:57 +00:00
|
|
|
# [H106] Don't put vim configuration in source files.
|
2016-11-08 18:07:56 +00:00
|
|
|
# [H203] Use assertIs(Not)None to check for None.
|
2017-09-07 17:10:07 +00:00
|
|
|
# [H204] Use assert(Not)Equal to check for equality.
|
|
|
|
# [H205] Use assert(Greater|Less)(Equal) for comparison.
|
2022-02-17 23:50:30 +00:00
|
|
|
# [H210] Require 'autospec', 'spec', or 'spec_set' in mock.patch/mock.patch.object calls
|
2016-11-08 18:07:56 +00:00
|
|
|
# [H904] Delay string interpolations at logging calls.
|
2020-04-28 12:44:43 +00:00
|
|
|
enable-extensions=H106,H203,H204,H205,H210,H904
|
2021-03-08 17:53:49 +00:00
|
|
|
# [E402] Module level import not at top of file
|
2020-04-28 12:44:43 +00:00
|
|
|
per-file-ignores =
|
2020-05-12 10:02:32 +00:00
|
|
|
ironic/cmd/__init__.py:E402
|
|
|
|
ironic/tests/base.py:E402
|
2013-11-19 00:15:25 +00:00
|
|
|
|
|
|
|
[hacking]
|
2014-09-11 21:04:47 +00:00
|
|
|
import_exceptions = testtools.matchers, ironic.common.i18n
|
2018-03-22 17:44:01 +00:00
|
|
|
|
2020-03-28 11:00:14 +00:00
|
|
|
[flake8:local-plugins]
|
|
|
|
# [N323] Found use of _() without explicit import of _!
|
|
|
|
extension =
|
|
|
|
N323 = checks:check_explicit_underscore_import
|
|
|
|
paths = ./ironic/hacking/
|
|
|
|
|
2019-06-03 07:04:41 +00:00
|
|
|
[testenv:bandit]
|
2020-12-14 13:00:25 +00:00
|
|
|
usedevelop = False
|
2019-06-03 07:04:41 +00:00
|
|
|
deps = -r{toxinidir}/test-requirements.txt
|
2019-06-20 06:10:54 +00:00
|
|
|
commands = bandit -r ironic -x tests -n5 -ll -c tools/bandit.yml
|
2024-02-10 00:02:20 +00:00
|
|
|
|
|
|
|
[testenv:codespell]
|
|
|
|
description =
|
|
|
|
Run codespell to check spelling
|
|
|
|
deps = codespell
|
|
|
|
# note(JayF): {posargs} lets us run `tox -ecodespell -- -w` to get codespell
|
|
|
|
# to correct spelling issues in our code it's aware of.
|
|
|
|
commands =
|
2024-05-10 21:31:55 +00:00
|
|
|
codespell {posargs}
|
2024-06-28 18:49:29 +00:00
|
|
|
|
|
|
|
[testenv:local-ironic-dev]
|
|
|
|
constrain_package_deps = true
|
|
|
|
usedevelop = True
|
|
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
|
|
LANGUAGE=en_US
|
|
|
|
LC_ALL=en_US.UTF-8
|
|
|
|
PYTHONUNBUFFERED=1
|
|
|
|
deps =
|
|
|
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
|
|
|
-r{toxinidir}/requirements.txt
|
|
|
|
-r{toxinidir}/driver-requirements.txt
|
|
|
|
python-ironicclient
|
|
|
|
python-openstackclient
|
|
|
|
allowlist_externals = bash
|
|
|
|
commands =
|
|
|
|
bash -c 'ironic-dbsync --config-file={toxinidir}/tools/ironic.conf.localdev create_schema || echo "===== DB already exists; continuing ====="'
|
|
|
|
ironic --config-file={toxinidir}/tools/ironic.conf.localdev {posargs}
|
|
|
|
passenv = http_proxy
|
|
|
|
HTTP_PROXY
|
|
|
|
https_proxy
|
|
|
|
HTTPS_PROXY
|
|
|
|
no_proxy
|
|
|
|
NO_PROXY
|