319 Commits

Author SHA1 Message Date
Doug Hellmann
3f98da0354 fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in [testenv].

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 must explicitly set basepython in envs that are usually "automatic" -
otherwise due to https://github.com/tox-dev/tox/issues/425 these will
use `basepython` instead of their automatic equivalents.

Change-Id: I1026110f0f1736127cf0af8ec2ef791a0f999e3a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-08 08:55:56 -05:00
Matt Riedemann
0a461979df Implement granular policy rules for placement
This adds a granular policy checking framework for
placement based on nova.policy but with a lot of
the legacy cruft removed, like the is_admin and
context_is_admin rules.

A new PlacementPolicyFixture is added along with
a new configuration option, [placement]/policy_file,
which is needed because the default policy file
that gets used in config is from [oslo_policy]/policy_file
which is being used as the nova policy file. As
far as I can tell, oslo.policy doesn't allow for
multiple policy files with different names unless
I'm misunderstanding how the policy_dirs option works.

With these changes, we can have something like:

  /etc/nova/policy.json - for nova policy rules
  /etc/nova/placement-policy.yaml - for placement rules

The docs are also updated to include the placement
policy sample along with a tox builder for the sample.

This starts by adding granular rules for CRUD operations
on the /resource_providers and /resource_providers/{uuid}
routes which use the same descriptions from the placement
API reference. Subsequent patches will add new granular
rules for the other routes.

Part of blueprint granular-placement-policy

Change-Id: I17573f5210314341c332fdcb1ce462a989c21940
2018-05-17 11:12:16 -04:00
Zuul
dcdcb27360 Merge "add lower-constraints job" 2018-05-15 01:12:25 +00:00
Doug Hellmann
e95af3f91c 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: Ic28558ee6481d49a9b4e5dc2c4182504e330448f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Co-Authored-by: Eric Fried <efried@us.ibm.com>
Co-Authored-by: Jim Rollenhagen <jim@jimrollenhagen.com>
2018-05-14 16:47:07 +00:00
Stephen Finucane
35759d5e4b Remove stale pip-missing-reqs tox test
pip_missing_reqs tool is no longer maintained and has broken with
release 10 of pip

Refer to:
 http://lists.openstack.org/pipermail/openstack-dev/2018-April/130027.html

Change-Id: I1b02384494ae9f440b72b98d9ae5f31d88dc8967
2018-05-01 17:40:03 +01:00
melanie witt
ef7e2a1988 Default to py3 for the pep8 tox env because it's stricter
We recently fixed a couple of pep8 failures under py3 [0] which got
through because we're not gating pep8 on py3. This changes the python
version for the pep8 tox env to python3 because the py3 checks are
stricter. This updates the fast8 tox env as well.

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

Change-Id: I540377606a8224ba569b8c145773e7d057575bd8
2018-04-04 15:24:00 +00:00
Stephen Finucane
b862f6ff35 tox: Make everything work with Python 3
Nothing too fancy here except that we've to work around a really ugly
side-effect of blockdiag.

Change-Id: Ibd32d30aacae65702d0ccbdb8a02b1667ec4e8ee
2018-03-28 12:57:24 +01:00
Stephen Finucane
a2821bdf6f tox: Remove unnecessary configuration
These were either unnecessary or overrode default configuration.

Change-Id: Ie17998dc564f06e9133c8412c24bc041b1e9a603
2018-03-26 15:12:28 +01:00
Stephen Finucane
9f5103f4e1 tox: Fix indentation
Makes life easier for future, actually important changes.

TrivialFix

Change-Id: Idda28f153d5054efc885ef2bde0989841df29cd3
2018-03-26 15:05:08 +01:00
Stephen Finucane
c21ab6b134 Follow the new PTI for document build
The Project Testing Interface [1] asks that we list requirements in
'doc/requirements.txt' and build docs by calling 'sphinx-build' directly
instead of via the 'build_sphinx' setuptool/distutils wrapper. Start
doing this.

[1] https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: If9342c8ea757b1735f2488db751008984fb33baf
2018-03-16 14:39:36 +00:00
Zuul
912d6cbe0b Merge "Remove single quotes from posargs on stestr run commands" 2018-02-17 15:49:01 +00:00
Matthew Treinish
3b673dda6a
Remove single quotes from posargs on stestr run commands
This commit removes the single quotes from all the stestr run commands
in the tox.ini. These were originally added as a workaround from the
ostestr days to ensure people could run a subset of tests with a regex
like:

  tox -epy27 regex

With the switch to stestr this is no longer needed because stestr treats
extra arguments as a filter regex. Quoting the posargs has a negative
effect because '--' parameters are treated as a string on input instead
of a parameter.

Fixing this also uncovered another issue in the stestr commands for the
functional jobs. The CLI arg for stestr versions <=1.1.0 is
--group_regex not --group-regex. This commit fixes this to make those
jobs pass without the quotes.

Change-Id: I512a517fa6890b29de24060376b4d7e061dc3add
2018-02-16 22:07:22 -05:00
Zuul
233285de49 Merge "add whereto for testing redirect rules" 2018-01-25 06:48:57 +00:00
Chris Dent
ad34193059 Enable py36 unit tests in tox
With the current super-explicit version of tox.ini, it is not possible
to run tox -epy<any version> and have tests discovered and run. This
is because the default testenv does not run tests. Therefore, the
easiest way to add another version is to simply add another testenv,
as done in this change.

Python3.6 is the default Python3 on recent distributions so it needs
to be present if people are expected to be able to run python3 unit
tests before pushing their changes.

Change-Id: I728e482af3142bb101fc6bf52ec7926e29a42594
2018-01-16 10:14:46 +00:00
Matthew Treinish
9c56c78513
Finish stestr migration
Nova switched to using stestr for all it's in tree testing except for
the coverage job. This commit updates that job so it also uses stestr
and cleans up the last bits of testr setup left in tree. As part of
this change this moves all the one off per job configuration into the
tox job definitions instead of hiding it in either the .stestr.conf or
in a wrapper script.

Change-Id: I36e0e791d485b44641a1ed8770eca8e95aca19be
2017-11-24 16:51:12 -05:00
Doug Hellmann
cec0faa711 add whereto for testing redirect rules
Use whereto to test that the redirect rules do what we expect. The
test coverage is a bit minimal for now, but should be useful as an
example of how it can be extended. The test files in the
openstack-manuals repo provide some other examples.

Depends-On: I36003d3525dcc9fef8e5f008ecabb2b2ac78088e
Change-Id: Ia14bfa6c89fd04844842d727d11ff8874ec7fc2a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-10-30 12:37:23 -04:00
melanie witt
53f244da12 Make setenv consistent for unit, func, and api-samples
Since ostestr switched to running stestr under the covers, we lost the
old magic setting of the environment variables via .testr.conf for
capturing stderr/stdout and the test timeout. This makes the unit,
functional, and api-samples envs consistent with the py27 env that was
already updated to set those variables.

This also updates the pretty_tox3.sh script to run stestr directly.

Change-Id: I27fa9b7e25c1a1dc921653eec84864423f898a85
2017-10-05 21:45:46 +00:00
Matthew Treinish
01b935cfe4
Add slowest command to tox.ini
This commit adds a printing of the 10 slowest tests during the run at
the end of the tox jobs. People have found this useful in the past and
ostestr used to do this by defualt. But, now that stestr is used to run
tests we need to make this call after a run to retain the output.

Change-Id: Ife81963e5ffb63e4ea09817e735eb768d7cf6209
2017-09-26 15:27:35 -04:00
Matthew Treinish
09fc560609
Add single quotes for posargs on jobs
People seem to hate the idea of using tox -epy27 -- foo to use a
test regex so add single quotes around posargs to make it so you can
just do tox -epy27 foo again.

Change-Id: I12c5d2dc78db3bc8954ff420492115ff53c42703
2017-09-15 11:15:06 -04:00
Matthew Treinish
531abe778a
Cleanup running of osprofiler tests
Now that we're using stestr directly we have more flexibility on how we
run the osprofiler tests. This patch makes it run second without test
discovery and combines the subunit output with the results of the
previous full test run.

Change-Id: I49db096dd3056a4fd2ec6e6603b59e70a8d25480
2017-09-13 17:22:19 -04:00
Matthew Treinish
d083eceea3
Fix test runner config issues with os-testr 1.0.0
The os-testr 1.0.0 release had a couple of required config changes due
to it's internal usage of stestr. This commit fixes those by adding a
.stestr.conf (to remove a warning) sets the fixture env variables in
the tox.ini instead of being hidden in .testr.conf and removing the
quotes around posargs to make passing args to ostestr actually work.
Also to keep the expected dev experience stestr is used directly for
places where ostestr was called directly.

Change-Id: Ib0fbcb2e7710a6b8219c56ef2a4462c61ea498a9
2017-09-13 17:11:57 -04:00
Matthew Treinish
ce8ffc5303 Set regex flag on ostestr command for osprofiler tests
In the unit test tox jobs we run the whole test suite first and after
that exits successfully we also run the osprofiler tests while setting
an osprofiler env variable to enable osprofiler. However the regex isn't
being set properly in ostestr, you set the selection regex with the
--regex flag. [1] This only works by chance because ostestr will pass
any unrecognized args to the subprocess used to run testr internally,
and testr leverages that as a regex. But in the latest os-testr release
it doesn't subprocess internally anymore and this doesn't work. This
commit fixes things to properly set the regex in ostestr so it works in
both old and new versions.

The order of the test runs is also switched because we capture the last
test run's subunit for openstack-health and other analysis, so we want
to full test run to be used for this.

[1] https://docs.openstack.org/os-testr/latest/user/ostestr.html#test-selection

Change-Id: I890505d65ca6043ddbdcc5895f2620391b505756
2017-09-07 15:30:36 -04:00
Andrey Volkov
fa5749727f [placement] Make placement_api_docs.py failing
If there is no api reference for some placement API method
tox -e placement-api-ref will fail now.

Change-Id: Ifefedcd51f1f8d5e741ef6d02b7a0879a185e05f
2017-08-10 11:27:13 +00:00
Balazs Gibizer
dd26d3d141 do not pass proxy env variables by tox
In an environment where http_proxy env variable is needed to buil a
proper python virtualenv the functional test fails with:
RuntimeError: http_proxy or https_proxy set in environment, please unset

This patch removes passing proxy env varibles in tox.ini to avoid this
error.

Change-Id: Ia4d8fe952aecb5c3e688878ef0fdafd6fac4fc7a
Closes-Bug: #1706545
2017-08-01 11:44:55 +00:00
Stephen Finucane
62ccbe1c3f doc: Enable pep8 on doc generation code
As pep8 does not run on doc generation python code so we have some
style violations there. As it not too hard to fix the problems and
therefore enable pep8 on these files this patch proposes such a
change.

Change-Id: I26104ea66fc4f3e67f8227025f43202e483beb25
2017-07-12 14:20:25 +01:00
Jenkins
4fc8065b9d Merge "[placement] Fix placement-api-ref check tool" 2017-05-24 21:30:55 +00:00
Andrey Volkov
90cabd0c8c [placement] Fix placement-api-ref check tool
Some time ago the placement-api-ref source structure was changed
(Ia2fd62ae7f401cad34ee7c2b355c9a5ab1c93f6b) to use inc-files istead of
putting all in index.rst, but that change broke placement_api_docs.py.

This change modifies placement_api_docs.py to go through all *.inc files
in placement-api-ref directory and scan for the "rest method" header.

Change-Id: I60150ab51173934f848662499dcf6af18625697e
2017-05-24 12:15:28 +03:00
Jenkins
9715715cb6 Merge "remove flake8-import-order" 2017-04-11 17:11:35 +00:00
Sean Dague
e239c5b712 remove flake8-import-order
This continues to make wrong guesses in many environments, and it only
slows down running pep8. Do not have this in the tree.

Change-Id: Ia63a279685160157385cc231c4b6dc2243f31d01
2017-04-07 15:06:06 -04:00
Jeremy Stanley
44ea834438 Switch from pip_missing_reqs to pip_check_reqs
The pip_missing_reqs tool is abandoned and now incompatible with
recent versions of pip. It has been supplanted by the pip_check_reqs
tool which provides the same pip-missing-reqs entrypoint (plus some
others), effectively renamed.

    https://github.com/r1chardj0n3s/pip-check-reqs/commit/99c5628
    https://ask.openstack.org/question/105026

Change-Id: I3fab8439891fab7ca837230dfccf89e4c0a7190c
2017-04-04 14:46:26 +00:00
Jenkins
bde8c7c615 Merge "tox: Stop calling config/policy generators twice" 2017-03-28 10:58:02 +00:00
Jenkins
de0c41b5fe Merge "Tests: remove .testrepository/times.dbm in tox.ini (functional)" 2017-03-27 13:31:01 +00:00
Stephen Finucane
4e2441d2ff tox: Stop calling config/policy generators twice
oslo.config and oslo.policy provide Sphinx integrations for building and
showing sample config and policy files, respectively. These integrations
are registered as hooks that will fire when the builder is initialized
[1][2]. As a result, these commands do not need to be manually called.
Stop doing so.

[1] https://github.com/openstack/oslo.config/blob/3.23.0/oslo_config/sphinxconfiggen.py#L89
[2] https://github.com/openstack/oslo.policy/blob/1.21.0/oslo_policy/sphinxpolicygen.py#L73

Change-Id: I6c18b06c92370d28226f2814a3c094e60985cb83
2017-03-27 11:19:25 +01:00
Jenkins
4613b33674 Merge "Structure for simply managing placement-api-ref" 2017-03-24 20:17:52 +00:00
Chris Dent
8c59991363 Structure for simply managing placement-api-ref
This consists of a duplicate of the [nova-]api-ref setup and
conf.py along with tooling to fail the tox -edocs target when
a route that is defined in
nova.api.openstack.placement.handler.ROUTE_DECLARATIONS is not
present in placement-api-ref/source/index.rst.
tools/placement_api_docs.py will report which routes are missing.

Though completely gameable (as demonstrated in the current lame
index.rst) it's better than nothing and provides some useful
structuring on what to do next. It's also the case that the 'docs'
target in tox is not part of gating.

The response for GET / is in place with the necessary
parameters.yaml for it to be correctly described. The 'get-root.json'
file provides the JSON of the expected response. The expectation is
that later commits will add information for other urls and their
JSON files will be named method-path-separated-by-dash.json with a
request/response qualifier as necessary.

Followup patches will add other routes.

A new parameters.yaml is used instead of reusing the one from
api-ref as there isn't a lot of expected overlap and having a
separate file will ease eventual extraction.

Running tox -eplacement-api-ref will generate the docs for review,
with output in placement-api-ref/build/html/index.html.

This will be hooked up with CI to deploy the generated docs,
eventually.

Change-Id: Ifb4d91d39db0e49b55952e37cdfc9f63dcd37aa3
2017-03-24 15:15:53 +03:00
Matt Riedemann
8c6e132966 Tests: remove .testrepository/times.dbm in tox.ini (functional)
Change 98cbf72e57e1d6950b3ea333b673c1c1c39a6cd7 handled this for
the py35 target but missed the functional-py35 target because
that one doesn't inherit the commands from the root testenv.

Change-Id: I018b809488f9e979f334c75415c15acb58dbd782
Related-Bug: #1229445
2017-03-21 16:06:41 -04:00
Jenkins
390c7e420f Merge "flake8: Specify 'nova' as name of app" 2017-03-21 18:11:06 +00:00
Jenkins
f8939f76e9 Merge "remove flake8-import-order for test requirements" 2017-03-21 17:55:02 +00:00
Jenkins
e3eac21382 Merge "More usage of ostestr and cleanup an unused dependency" 2017-03-20 16:04:47 +00:00
John L. Villalovos
07a042ba2c flake8: Specify 'nova' as name of app
Specify 'nova' as the name of the application for the flake8-import-order
plugin. That way it knows that imports of nova should come after external
libraries.

Fix issues discovered in ordering by this new check.

Change-Id: I822796ba3d750f93de813035aeee59e8ccb022a2
2017-03-16 13:48:51 -07:00
Sean Mooney
a5d4adbd60 remove flake8-import-order for test requirements
- When flake8-import-order is installed the additional
  ordering tests it provides are enabled by default.
- When devstack installs python projects from source
  such as nova, the pip_install function installs both the
  requirements.txt and test-requiremets.txt dependencies systemwide.
  As a result, any python project that runs pep8 tests without a
  python virtual environment will also have import ordering enforced
  which may fail.
- This change removes flake8-import-order from the
  test-requirements.txt to prevent failures in projects other
  than nova that don't enforce pep8 import ordering.

Change-Id: I994df178f0000a0840f6658ccc2f277d5503f826
2017-03-16 17:36:54 +00:00
Matt Riedemann
2ce3b0d076 Introduce fast8 tox target
The pep8 target has the little known "-HEAD" argument
which makes it only run flake8 on the changes since the
last change in the history.

Even though that's nice, it's sometimes hard to remember
the -HEAD argument. Plus pep8 is running some other
checks on things like the docs.

So if all you want is the pep8 -- -HEAD behavior, this
is a simplied convenient form of it.

Change-Id: I97b277d8ac95ca3ef8379570e0e3886df26263e1
2017-03-15 13:00:10 -04:00
Stephen Finucane
ac2a4abfca Duplicate JSON line ending check to pep8
The docs job is not run in the gate, meaning invalid JSON files with
\r\n line endings are able to sneak in. Duplicate the checks from the
docs environment to the pep8 environment so that gate jobs run it.

Note that pep8 is our general linting target and thus should include
these kind of tests.

Change-Id: Ie923902b04be79b9f66ba1841c60899a413f6439
Closes-Bug: #1673131
2017-03-15 16:05:38 +00:00
John L. Villalovos
66866b3ce6 Use flake8-import-order
Use the flake8 plugin flake8-import-order to check import ordering. It
can do it automatically and don't need reviewers to check it.

Change-Id: Ia3d81bbbb44b40804b3268c0e648276a36cb4805
2017-03-06 06:50:23 -08:00
Jenkins
1ef9cbdcf4 Merge "Tests: remove .testrepository/times.dbm in tox.ini" 2017-02-28 19:21:09 +00:00
Jenkins
c990c73f4f Merge "Enable coverage report" 2017-02-28 13:54:26 +00:00
Maciej Szankin
98cbf72e57 Tests: remove .testrepository/times.dbm in tox.ini
Existance of this file causes py3* tests to fail if
run after py27. This patch adds cleaning up of this
file before running py3* tests.

Change-Id: I64ef1eac7f05f217674c73ddd2cc3af773dd75ce
Closes-Bug: #1229445
2017-02-27 18:17:51 +00:00
Luigi Toscano
8e34aece1a More usage of ostestr and cleanup an unused dependency
Use ostestr as runner instead of the custome pretty_tox.sh script
(pretty much removed everywhere). pretty_tox3.sh is just a wrapper
for ostestr but it could be probably removed as well going forward.
Also remove the tempest-lib dependency, which originally provided
subunit-trace (now from os-testr).

Change-Id: I4390964ce83167d634b80f696e82a0e199582ce6
2017-02-23 18:25:08 +01:00
Jenkins
0d0859573d Merge "Remove references to Python 3.4" 2017-02-23 12:43:41 +00:00
yushangbin
23b2adcc68 Enable coverage report
Enable coverage report in tox.ini.

Change-Id: Ifcb5d5d78e2a06e807050ce18e34e1d1f0fa1972
2017-02-21 19:51:47 +08:00