105 Commits

Author SHA1 Message Date
Riccardo Pittau
9cfd98e577 Increase version of hacking and pycodestyle
Fix errors in unit tests

Change-Id: Ibc8648b64887daac6fb5ec8a6dd61d9312a52ef3
2021-07-29 11:19:36 +02:00
likui
b912248f09 Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: I143ef78dec2ffff6b1c309036d50533591c20171
2021-06-03 16:53:55 +08:00
Riccardo Pittau
e670c24ea2 Update minversion of tox
The minimum version since when tox accepts having inline comments
in deps is 3.9.0

https://tox.readthedocs.io/en/latest/changelog.html#v3-9-0-2019-04-17

Change-Id: I2a42de56b0d1c48604f026d27c1d262181cfe29b
2021-01-22 08:56:21 +01:00
Riccardo Pittau
fb5955bcce Update version of doc8
The doc8 lib supports Python 3.6 starting from version 0.8.1

Change-Id: I1acd3f12acbaf413e0752155c1e78e84824034af
2021-01-05 09:00:42 +01:00
Dmitry Tantsur
8d52a7789a Avoid a full install in tox environments that do not need it
Usage of usedevelop=True results in all requirements.txt dependencies
always installed (without constraints) even when requirements.txt
is not explicitly added. Override usedevelop for these environments.

Add requirements.txt to the 'docs' environment since it imports
the whole ironic in the process.

Create a separate doc/requirements.txt.

Change-Id: I352f21772ccd68b35806f46851f254edb7c24c60
2020-12-14 14:18:46 +01:00
Riccardo Pittau
caf9256b22 Fix lower-constraints with the new pip resolver
Remove pep8 dependencies from test-requirements, they're not
needed there and are hard to constraint properly.

Change lower-constraints to make pip happy and not require infinite
time to calculate dependencies.

Change-Id: Id524ad2bd2994fefadd6a3ad728123a0a1a49dc8
2020-12-10 06:04:30 -08:00
likui
4ce61af741 Reuse the docs deps to benefit from constraints
Tox trying to install latest versions for building docs,
which may not be supported by stable and lower branches,
so should be restricted by respective version's upper-constraints.txt

Change-Id: Ic2a8a264e95ecd70902329fc5de3839625845129
2020-11-18 09:59:35 +08:00
Vladyslav Drok
d77ce5cabd Remove unicode quotes from tox.ini
On some locales and some versions of python these quotes might not
decode properly, causing tox to fail to run pep8 environment, so
let's change them to the usual ASCII ones.

Change-Id: Ib60844aa222c65c7862adf817c5cb73e1d1cf5f4
2020-11-04 17:08:24 +01:00
likui
ca47af38d0 Use TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
This allows to use upper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

[1] https://review.opendev.org/#/c/722814/
[2] https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file

Change-Id: I62f320a0406c0ed8b025e889da0c928f48ef0545
2020-11-03 13:17:06 +08:00
likui
8e9adf1293 use py38 for functional tests
we should test py38 by default.

[1] https://governance.openstack.org/tc/reference/runtimes/wallaby.html

Change-Id: Ib10a065105a740450e2c486a88b773b803847bd7
2020-10-15 18:14:30 +08:00
Dmitry Tantsur
a5e8cce1af CI: run doc8 on api-ref
Change-Id: I000ffe5915a1c74b0e4eeb93ceeb4aee429a1901
2020-07-28 12:45:47 +02:00
Riccardo Pittau
32d68ef53b Set min version of tox to 3.2.1
As recommended, since version 3.2.0 tox switches pip invocations
to use the module -m pip instead of direct invocation.
We set min version to 3.2.1 [1] to also fix the behavior of
--parallel--safe-build

[1] https://tox.readthedocs.io/en/latest/changelog.html#v3-2-1-2018-08-10

Change-Id: I64afec683ca3ac0e750ce30d689441d3517671b5
2020-07-15 15:26:06 +02:00
Iury Gregory Melo Ferreira
b9f1746643 Stop configuring install_command in tox.
Currently, we are overriding 'install_command' to use 'pip'. This is
considered poor behavior and 'python -m pip' should be used instead:

https://snarky.ca/why-you-should-use-python-m-pip/

It turns out that this is the the default value provided by tox:

https://tox.readthedocs.io/en/latest/config.html#conf-install_command

So we can remove the line and simply use the default value.

openstack-discuss thread
http://lists.openstack.org/pipermail/openstack-discuss/2020-April/014237.html

Bumping requirements and l-c with:
keystoneauth1 3.18.0
alembic 0.9.6
pika 0.10.0 (necessary for installation)
Change-Id: I849342bd077ab2f8bbda4e0a228c308eb7a4908b
2020-05-14 14:56:26 +02:00
Dmitry Tantsur
cee5922674 Hacking: enforce usage of autospec=True in tests
Using autospec ensures that mocked functions are called with correct
arguments, so it's highly desired to have it.

Change-Id: I9c8395adf852495d2ef6db732d727990e8abd5d7
2020-04-28 12:27:41 +02:00
Andreas Jaeger
1a8c1bb370 Cleanup py27 support
This repo is now testing only with Python 3, so let's make
a few cleanups:
- Remove python 2.7 stanza from setup.py
- Add requires on python >= 3.6 to setup.cfg so that pypi and pip
  know about the requirement
- Remove obsolete sections from setup.cfg
- Update classifiers
- Update requirements, no need for python_version anymore
- Switch to using sphinx-build with apidoc extension
- Use newer openstackdocstheme version
- Remove Babel requirement, this is not needed.

Change-Id: I4176d8002d45449171aa5f7a7caef196ab7900d0
2020-04-20 08:18:51 +02:00
Riccardo Pittau
4eefb42550 Finalize ironicclient removal
Completely remove dependency from ironicclient in favor of
openstacksdk.

Change-Id: I9b98ddb05fe867a0d3884f736a2edd7b4d61b00c
2020-03-25 10:08:38 +01:00
Zuul
af43de3b23 Merge "Enforce running tox with correct python version based on env" 2019-12-26 15:32:06 +00:00
Madhuri Kumari
51e791e954 Add librsvg2* to bindep and bindep env
76cbd2dbbb131224e73a4b7c4019c378d2bbaf20 added the docs
build requirement on sphinxcontrib-svg2pdfconverter which
needs the native rsvg-convert command. This change adds
the native package that provides that command to bindep.txt.
Also adds bindep env in tox.ini.

Change-Id: I72aa8695c058989b4a1aa62cbb5d5fda2ce348ad
2019-12-24 13:03:35 +05:30
Riccardo Pittau
917d2e44eb Enforce running tox with correct python version based on env
Since removing support for Python 2, we changed the basepython
value to 3.
This means that all the tox tests run with the default python
version available in the system.
This is not quite correct when running on environment such as
py36, py37 or py38, since they imply running with different
Python versions based on the environment.
To enforce the correct version we need to add the option
ignore_basepython_conflict available since tox 3.1.0 [0].

[0] https://tox.readthedocs.io/en/latest/config.html#conf-ignore_basepython_conflict

Change-Id: Ia14bc6397a88f200277abc5485cab02eb3724e1b
2019-12-20 16:24:13 +01:00
Kaifeng Wang
0e3cd671da Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

ironic-inspector is ready with python 3 and ok to drop the
python 2.7 support.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal - https://review.opendev.org/#/c/691178/

Change-Id: Ifae00adf782b6a7d71c4dc45a69a9638b8514d30
2019-11-22 11:17:34 +08:00
Kaifeng Wang
76cbd2dbbb Build pdf doc
The is one of community goals that each project could produce a
single PDF file. The pdf should be in the output of openstack-tox-docs
job.

TeX packages are required to build PDF locally, following is recommended:

* inkscape
* texlive-latex-base
* texlive-latex-extra
* texlive-fonts-recommended

More about the goal:
https://governance.openstack.org/tc/goals/train/pdf-doc-generation.html
https://etherpad.openstack.org/p/train-pdf-support-goal
https://etherpad.openstack.org/p/pdf-goal-train-common-problems

Change-Id: I784be3f2462184ce951cb27e68e578f8befaa580
2019-09-06 15:58:06 +08:00
Dmitry Tantsur
4f578169c7 Allow running a specific functional test via CLI
Change-Id: I5897d8121b7cc992d64f948f73f1f846615f6e46
2019-07-18 14:25:41 +02:00
Kaifeng Wang
f979456c16 testenv does not install requirements
Fix testenv which only installs test-requirement, also updated
upper constraint url.

mock minimum version is bumped to 3.0.0,
keystonemiddleware minimum version is bumped to 4.18.0.

Change-Id: I162bcf372598c2268c9c5e30947e49eedb0147e3
2019-07-16 10:38:14 +08:00
Kaifeng Wang
30a4e0981f Adds bandit template and exclude some of tests
Adds bandit configuration template and exclude some of
tests that we don't want to fix for the moment.

Keeping job unvoted so that we can keep an eye on possible
issues while not breaking gate.

Change-Id: Icc055980c13696b29c512edf8c48abba924aa244
Story: 2005791
Task: 33563
2019-06-20 14:35:43 +08:00
Kaifeng Wang
52349c6c0a Incorporate bandit support in CI
Change-Id: I1beded7e0198a5b5b43df00a355cf1c59cf2dc27
Story: 2005791
Task: 33563
2019-06-05 08:44:38 +08:00
Riccardo Pittau
ba545df90a Removing python 3.5 testing in favor of 3.6
This patch removes the python 3.5 tests in favor of python 3.6
tests.

Change-Id: I455782a1c1ae5ca351aa90a4f67e4a0525a43e36
2019-02-22 11:49:52 +01:00
Zuul
054f300290 Merge "Add API reference" 2018-10-22 20:31:33 +00:00
Anton Arefiev
05a86b3d57 Add API reference
Add initial API reference, which covers all inspector endpoits.

The conf.py and the tox environment are stolen from ironic.

Co-Authored-By: Kaifeng Wang <kaifeng.w@gmail.com>
Change-Id: I5009e8708dcad8ab25380f7bf574125d6e758ef5
2018-10-16 16:50:01 +08:00
Kaifeng Wang
8ab225e47a Rearrange conf and policy configuration file
Minor project file structure adjustment, to move config-generator.conf
and policy-generator.conf into tools/ subdirectory.

Also exclude tools/ from dsvm jobs.

Change-Id: I3242401511b88bd9b677d9875481808783f890b8
2018-10-16 16:16:29 +08:00
Kaifeng Wang
292c168d9e Follow up to pycodestyle fix
During pycodestyle fix [0], the max code complexity is temporarily
increased to 18.

This patch is a follow up to restore previous complexity (value 15),
and refactor code causing C901.

[0] https://review.openstack.org/#/c/567066

Story: #2001985
Task: #19604

Change-Id: Id64c31c449761024504284dcadd2b6c9f4a97f00
2018-08-03 16:53:44 +08:00
Zuul
7991f12e17 Merge "Switch to using stestr" 2018-07-16 14:49:41 +00:00
Chuck Short
cce25ed22e Switch to using stestr
According to Openstack summit session [1] stestr is maintained project
to which all Openstack projects should migrate.

Let's switch it then.

Also adjust requirements to pass the gate.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: I79b2220c20a04e2e33360bc330b5b4b4124caf71
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-07-14 07:49:50 -04:00
huang.zhiping
0feeaf1f9b fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: Ic87686868f784f0e1b514d6b899cc16240d88d61
2018-06-09 11:47:48 +00:00
Harald Jensås
868965c340 Fix pycodestyle warnings/errors now visible with hacking 1.1.0
This fixes the warning/errors except for the C901 Function is
too complex in the ironic_inspector/rules.py's create method.

Bump's max-complexity to 18 in tox.ini to workaround the C901.

Story: 2001985
Task: 19604
Change-Id: I6c76a43353b1beb572dbde78dba4b4a839d45ea7
2018-05-08 23:46:05 +02:00
Doug Hellmann
5113ef51c5 add lower-constraints job
Create a tox environment for running the unit tests against the lower
bounds of the dependencies.

Create a lower-constraints.txt to be used to enforce the lower bounds
in those tests.

Add openstack-tox-lower-constraints job to the zuul configuration.

See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.

Change-Id: I8a5c47cb8e4d623776cd4335754184f6f7f0d398
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-03-22 13:44:49 -04:00
Nguyen Hung Phuong
2dba74430e Remove empty files
plugin-requirements.txt
is empty file. We probably should delete it.

Change-Id: I8029e606a7d284287d4d430cbde479a252a33e64
2018-01-29 16:29:57 +07:00
Pavlo Shchelokovskyy
d3fd0d98ad Use general py3 tox env for default tox run
different distros already come with different minor versions of Python3,
so let's use general 'py3' tox env when invoking tox without specific
env.

This is just a convenience for developers and will not affect gates,
as they use specific tox envs, all of them pre-generated by tox by
default.

Change-Id: Ife1d1b66e5ebf698f16a5b830604117a6e111107
2017-12-28 15:00:19 +02:00
Andreas Jaeger
396ce758e9 Use native v3 tox jobs
Instead of a legacy tox job, use the already defined functional jobs
that do the same. Note that those jobs are named "functional", so update
tox.ini as well.

Remove unused playbooks.

Change-Id: Icdb1b94b0e69ffb55007e166705871010e8943c5
2017-12-17 18:58:58 +01:00
Zuul
15ebcf32ce Merge "Add request context and policy enforcement" 2017-10-19 21:40:24 +00:00
John L. Villalovos
7dbb7c1721 flake8: Enable some off-by-default checks
Enable the following off-by-default checks:
    * [H204] Use assert(Not)Equal to check for equality.
    * [H205] Use assert(Greater|Less)(Equal) for comparison.

Increase the version of hacking in test-requirements so that can use new
off-by-default checks.

No changes to code were required.

Change-Id: I7fe394d99eee980e90768902b9fc264a8be3fe15
2017-10-16 14:25:15 -07:00
John L. Villalovos
19c1b8e5ca pep8: Add 'application-import-names = ironic_inspector'
Add 'application-import-names = ironic_inspector' to tox.ini.

Update files which failed pep8.

Change-Id: Ib908b75ac2bf262773978be62e11f973f9eba0d2
2017-10-16 14:24:48 -07:00
John L. Villalovos
2e25c5ed76 Fix for broken zuul v3 job and releasenotes
The Zuul v3 job is looking for the log files from the release notes
in: .tox/releasenotes/log/ but we had then in .tox/venv/log/

Fix it to where they Zuul v3 job expects it to be.

Change-Id: Ic0810a681efefe2be4656bc66e2477710a8b15dd
2017-10-16 12:06:34 -07:00
Pavlo Shchelokovskyy
198ef70c2b Add request context and policy enforcement
this patch introduces an oslo.policy-based API access policy
enforcement engine to ironic-inspector.
As part of implementation, a proper oslo.context-based request
context is also generated and assigned to each request.

Short overview of changes:

- added custom RequestContext class

  - extends oslo.context to handle of "is_public_api" flag
    (False by default)

- added context to request in each API route

  - '/continue' api sets the "is_public_api" flag to True

- added documented definitions for API access policies and their
  defaults
- added enforcement of these policies on API requests
- added oslo.policy-specific entry points to setup.cfg
- added autogenerated policy sample file with defaults
- added documentation with autogenerated policies

Change-Id: Iff6f98fa9950d78608f0a7c325d132c11a1383b3
Closes-Bug: #1719812
2017-10-13 11:55:52 +00:00
Pavlo Shchelokovskyy
7625ed68c8 Use ostestr unit test runner
This patch moves ironic-inspector to use 'stestr' test runner
via 'ostestr' wrapper.

Effective changes:

- unit tests are now being run in parallel by default
- 'py*' jobs are not running code coverage measurements,
  which is left for 'cover' job only
- 'cover' job now also produces html reports consumable by upstream CI,
  and fails under 90% of code coverage
- users can leverage all the ostestr/stestr features

Change-Id: I75f539457dbb1d811fdee69de52d1bcee4c6ebe6
Depends-On: Ica838db23b5714c2da1e4313e1a7ece0ca241d44
Closes-Bug: #1666232
2017-10-02 14:28:58 +00:00
dparalen
b1ce6f9ba3 Bump pydot2 to pydot3
pydot2 is incompatible with python3[1]. Bumping the pydot release (through
the test-requirements.txt) rather than pinning basepython to fix this.

Also updating the states.svg with the tox -egenstates result of running
pydot3

[1] https://github.com/erocarrera/pydot/issues/107

Change-Id: I9aa0e701af3915b39e1a5681c2105a6afb687dd2
Depends-On: I82e3651eefd3186c9e131b0db29a328967fb3161
2017-05-17 16:51:32 +02:00
Ramamani Yeleswarapu
7a670bfd5d Unpin python3 version for functional tests
Change-Id: I72a606b557ad552e5fc4279d2e79e1f2a424cda9
Closes-Bug: #1670461
2017-04-03 12:11:10 -07:00
Jenkins
04bc1cd404 Merge "Fix tox test failed because timezone is CST" 2017-03-06 21:25:46 +00:00
lihao
5b97e40c19 Fix tox test failed because timezone is CST
When the timezone of an ironic-inspector develop environment is CST,
tox test will fail. So we should set TZ to UTC by default.

Change-Id: Icebef00efe029d793e04e1aec81132805009bde0
Closes-Bug: #1669699
2017-03-05 07:09:48 +00:00
Annie Lezil
36ac6a388b Python 3.4 (py34) is removed from tox envlist
Python 3.4 is not a supported python version. So removing it from tox
envlist

Change-Id: I50e5f97cfac1d2f602da43c3c7a78566d58491e2
Related-Bug:1667312
2017-03-03 18:30:50 +00:00
Jenkins
234731b74a Merge "Add fsm dot diagram generator" 2017-03-02 16:46:33 +00:00