265 Commits

Author SHA1 Message Date
Ihar Hrachyshka
4e25ba840a Switch to new hacking 0.12
The release includes its own check for delayed string interpolation for
log messages, so we can now remove our own check for the same thing. The
check is off-by-default, so we need to explicitly enable it. Sadly,
select= directive in tox.ini is broken [1] so we need to enable the
check with flake8 argument instead.

[1] https://github.com/PyCQA/pycodestyle/issues/390

Change-Id: Idc6b8e5b1cb594e130d4cc0cbcfffd362f9ab86a
2016-11-08 03:36:00 +00:00
Ihar Hrachyshka
a9585c7237 Added bindep.txt to the project
This allows to avoid installing unneeded packages when in gate, saving
some time when preparing environment for unit and other non-dsvm tests.

Change-Id: I09aa9c7ebebf12d0c0cce7457fef57f8451fcffa
2016-09-26 10:35:50 +00:00
Henry Gessau
961c5e73e9 Add tool to list moved globals
This tools list the constants and exceptions that have moved
to neutron-lib. Add it to pep8 to raise awareness of moved
globals.

Related Blueprint: neutron-lib

Change-Id: Ic6439f98d4bf8f566debf26eca3337f359119d5a
2016-08-18 10:14:42 -04:00
Jenkins
4478987fbd Merge "Add support for Python 3.5" 2016-08-14 13:02:58 +00:00
Ihar Hrachyshka
64a5f1d086 Constrain remaining tox targets
As per [1], we now can constrain targets that are executed in post
queue too.

[1] http://lists.openstack.org/pipermail/openstack-dev/2016-August/101474.html

Change-Id: I02b28d3b354c3b175147c5be36eea4dc7e05f2a3
2016-08-12 11:28:25 +02:00
Henry Gessau
97575c228b Enable DeprecationWarning in test environments
Many deprecations are triggered early (on imports, for example)
before the warnings are enabled by the WarningsFixture in the
base test class.

To make sure all DeprecationWarning messages are emitted we enable
them via the PYTHONWARNINGS environment variable.

Change-Id: I93d9447b5f26ba474d4c283a3df49cf4461c715d
NOTE: All subprojects should do this too.
2016-08-08 00:04:05 -04:00
Henry Gessau
345a4b28c1 Add support for Python 3.5
Depends-On: I1952f3247002fae73c2cfce294da91e5e013d68e

Change-Id: Ic2c880a48b3df4fe973b8a1737eb223048a4c47f
2016-07-14 22:07:59 -04:00
Brandon Logan
b06c7e857e Allow tox to be run with python 3
The tox.ini has some unicode characters that cannot be
decoded, so just executing tox will immediately cause an error
because the tox.ini cannot be parsed.

Closes-Bug: #1600068
Change-Id: Ia01ae80d9321584845bb06c3f6673d13027bd2db
2016-07-08 06:35:48 +00:00
Jakub Libosvar
766abb752a Make pep8 job great again
There is a bug in pep8, when 'select' used, it omits all default checks
and runs only those specified by 'select'.  We got hit by this issue
since I2d26534230ffe5d01aa0aab6ec902f81cfba774d was merged which lead to
almost no static checks in pep8 job.

Also note that off_by_default decorator has no effect for now because
factory in hacking is triggered after ignored checks are collected.
There will be a follow-up patch for that in order to make pep8 doing
its job quickly.

[1] https://github.com/PyCQA/pycodestyle/issues/390

Related-Bug: 1594756
Change-Id: I8e27f40908e1bb4307cc7c893169a9d99f3433c4
2016-06-21 16:23:51 +00:00
Gary Kotton
82c65df0bd Tox: Remove neutron/openstack/common from excludes list
Commit 56efc8ac76415070041d125a6e30523caf9b3cbd and
commit 7ddfffb0fc37f4fd04937b11ac03b95aeed1306c removed olso incubator.

So we can remove this from the files that are skipped as they no
longer exist.

TrivialFix

Change-Id: If88988edac2ae2829a8f5827f855812db56ba63e
2016-06-07 05:35:29 -07:00
Jenkins
e0c2122222 Merge "Use unittest2 uniformly across Neutron" 2016-06-01 16:18:53 +00:00
Martin Hickey
afaad48aa3 Use unittest2 uniformly across Neutron
unittest2 contains bug fixes to unittest for all versions of Python<3.5.
Move unittest references to unittest2.

Bumped hacking requirement to reflect the version in
openstack/requirements that is the minimal version that supports
off_by_default checks.

Change-Id: I2d26534230ffe5d01aa0aab6ec902f81cfba774d
Depends-On: I883223962426ed8e9cdf4e304dfed17ef0946c8a
2016-05-23 13:13:17 +00:00
Assaf Muller
8adc737cd1 Delete post_test_hook.generate_test_logs
Log files as .txt files, don't zip them, and put them where
they need to be instead of copy them there in the post gate
hook. The benefit to doing this is that we'll get logs
for tests even if the job timed out.

Change-Id: I4bfd27534c827aed3cbd7b43d7d1289480ea4806
Related-Bug: #1567668
2016-05-04 11:11:46 -04:00
Henry Gessau
74e7df482c Revert "Switch to inheriting hacking checks from neutron-lib"
This reverts commit 7e1601fcb8187ad42cdeb5f0b899253cc32458ba.

Change-Id: Ib2420370d29dd40c187197c611d05d1b4a13eaae
2016-04-24 15:19:20 +00:00
Doug Wiegley
7e1601fcb8 Switch to inheriting hacking checks from neutron-lib
Partially-Implements: blueprint neutron-lib
Change-Id: I78691012e9fa2a4ac31c370f28206d7257f83a63
2016-04-21 20:55:03 -06:00
Ihar Hrachyshka
aacc56ab28 tempest: enable hacking rule checks
Now that we stopped copying tempest code into our tree, it's fair to
enable the pep8 checks for the subtree.

Change-Id: Ie23b4db2d4d0e3e75e8fdf4af3bf0a430069928e
2016-04-18 23:47:33 +02:00
Armando Migliaccio
965e1d18a7 Move away from invoking api tests explicitly
Since adoption of the Tempest plugin framework, this
extra plumbing is no longer necessary in tree.

Related-bug: 1555356

Depends-on: If5f7ea82c45494953452f728fabb7403d0b6e14e
Change-Id: I5377f33c5a7b29f97f00878e048d154378a4fe34
2016-04-15 17:13:59 +00:00
Daniel Mellado
c56918027a Use tempest plugin interface
Make use of the Tempest plugin interface instead of copying Neutron
files into Tempest. This will remove the burden to port Neutron
tests onto Tempest master recurrently.

It uses neutron/tests/tempest/ as new top folder for all Tempest
tests. It follows the model of Heat [1].

[1]: https://github.com/openstack/heat/tree/master/heat_integrationtests

Partially implements bp external-plugin-interface

Change-Id: Ia233aa162746845f6ae08a8157dcd242dcd58eab
2016-04-14 15:19:14 +02:00
Armando Migliaccio
a6513175b5 Tempest 11.0.0 is released
Move the requirement to test-requirements so that we can pick up
bot proposals. Let's also match the global-requirement pin.

https://pypi.python.org/pypi/Tempest/11.0.0

Depends-on: Id2c7e09611c1f8b06e6d272589b4ea3435b8de86
Change-Id: I91d6432eabe3de1620fa1ab07ea715e29de62296
2016-04-08 16:36:34 +00:00
Ihar Hrachyshka
c25ece63bd Cleaned up tox_install.sh
Now that we don't need the script to pull tempest from git, it became
redundant. It's better to clean it up.

Change-Id: I8881840813339c20e4d5c59b98c2eff63f4feffb
2016-04-04 11:41:05 +02:00
Jenkins
98af306043 Merge "Fix zuul_cloner errors during tox job setup" 2016-04-02 04:24:56 +00:00
Armando Migliaccio
8a6913c534 Fix zuul_cloner errors during tox job setup
Since [1], Tempest is a pip installable package, and that prevents zuul_cloner
to work correctly. This change moves away from the existing logic in tox_install,
and adds tempest as an explicit requirement for the api job. This is in fact
the only tox target that needs Tempest to work.

tox_install.sh has become less important now, but cleanup is left as follow
up, to speed up gate salvation.

[1] I25eac915c977ebaedced66ac896c5dd77259d193

Depends-on: I1d1ca087982d7bdda983686775736ed258026aeb
Change-Id: I00d882dde77a687ecb57ec200a34fd96256ad87a
2016-04-02 02:02:52 +00:00
Akihiro Motoki
44be13a2a6 Hacking rule to check i18n usage
* Detect neutron.i18n import (neutron._i18n is recommended)
* Check builtins _ usage
* 'builtins = _' in tox.ini is no longer required.
* Introduce hacking rule doctest framework.
  Newly added check_builtins_gettext() hacking check takes
  token as argument. It is not a good idea to pass a tokenized
  line manually. Instead it is reasonable to use docstring based
  tests used in hacking repo.

Change-Id: Ib7464658fc4c8a6f1b03af6ab46f0bd3ee0bfb18
2016-03-30 21:28:37 -04:00
IWAMOTO Toshihiro
56912b99db fullstack: increase test timeout
Database teardowns seem to have a lock contention issue.  This is a
workaround.

Change-Id: Ifd0957a86646c6a13a71b5bbf985f4694e37e943
Partial-bug: 1541742
2016-03-11 11:35:01 +09:00
Ihar Hrachyshka
317f5b2dfc Remove unused -constraints tox targets
Now that gate does not rely on -constraints targets [1], we should be
safe to remove them.

[1] Iea3a0b1f740d5679ebfa135f2bf5b89c52008716

Change-Id: I59855f1b15d54323dcc7c4759904be7124a1df1a
2016-03-07 17:21:05 +01:00
Ihar Hrachyshka
e297d7d7db Make all tox targets constrained
Since neutron gate already switched to -constraints target, we need to
keep those targets until we switch gate back to using targets without
the postfix.

This change effectively makes both types of targets identical.

Note: override install_command for venv, releasenotes, and cover targets
since corresponding gate jobs do not provide constraints file yet.

Also removed cover-constraints target since it would never work in gate
anyway.

Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Co-Authored-By: Andreas Jaeger <aj@suse.com>
Change-Id: Ica2d509df0c54496aba7cb3162565384cc5d34c8
2016-03-04 20:11:56 +01:00
Davanum Srinivas
bc44321778 Switch "dsvm-functional:" into same pattern as constraints
In Ibdfc03f27450a5392acc276f98bfb464f9a0f663, the oslo team is
adding some periodic jobs to run oslo.* from master against
neutron's py27 and py34, this is done by extending the
existing tox targets. The presence of "dsvm-functional:" in
commands breaks the jobs.

The right way to fix this is to follow the same pattern
as the constraints by defining it once in
[testenv:dsvm-functional] and reusing it. However this will
not work as there is a bug in tox with posargs that Sachi just fixed:
https://bitbucket.org/hpk42/tox/pull-requests/189/fix-section-substitution-with-posargs/diff

So until we have a version of tox in our CI images with that
fix, we need to live with duplicate definitions.

Change-Id: I8880bf9caa269b9183dba8f269760af76461bca1
2016-02-11 18:21:36 -05:00
Doug Wiegley
828068181c Get tempest via zuul-cloner if needed and it is available
Change-Id: I70f402202f99a989ef5e95213669f4ca9f7b706f
2016-02-03 23:46:02 -07:00
Assaf Muller
a2fe5fd2e0 Delete Tempest fork, import from tempest and tempest_lib
A while ago we copied Tempest networking API tests in to the
Neutron repo, and along came thousands of lines of code of Tempest
testing infrastructure (neutron.tests.tempest). For a while we
periodically refreshed our fork via:
tools/copy_api_tests_from_tempest.sh

I think it's time we move away from that model by eliminating
the fork. We do this by deleting unused code and importing the
rest from tempest_lib. There's some Tempest code still not
moved from Tempest to tempest_lib in tempest.common. I think
it's preferable to import that code than to copy it, and Tempest
cores mostly agree. Manila and Ironic also do the same.
To be able to import from tempest I added it as a requirement:
Since Tempest is not on PyPi, I had to get it from git. Only the api
tests environment needs Tempest, so instead of adding it to
test-requirements, I added it specifically to the api and
api-constraints venvs.

neutron.tests.tempest.test and neutron.tests.tempest.common.*
still remain. These are tighly coupled with one another, and
sadly since Neutron forked Tempest code, Tempest has made significant
changes to those files that also require changes to the test files.
I aim to get rid of the Neutron fork of these files in a follow up
change.

Also fixed import grouping in test files so that it's std libs,
3rd party libs, and then Neutron code.

* Removed neutron.tests.tempest.config:
  - We only added one option after the fork. I created a new group
    called 'neutron_plugin_options' and moved the new option to that
    group. This is in preperation for the Tempest plugin architecture,
    where you're supposed to add new config options to a new group
    and not to existing configuration groups. Note that this is
    obviously a backward incompatible change, but it's to an option
    added in the same cycle.
* Removed neutron.tests.tempest.test and neutron.tests.tempest.common.
  - This introduced an API change to the way we access Keystone,
    which required mechanical changes to a few tests (create_tenant
    calls need a different client now).
  - The way Tempest manages primary, admin and alternative tenant
    credentials was changed after we forked, which required another
    mechanical change to a few tests.
* Cut all of the Keystone clients we don't need. We only need
  to create/delete tenants, the other clients were used in Tempest by
  actual Keystone tests.
* Changed neutron.tests.api.base.BaseNetworkTest:
  - Re-implemented get_client_manager so that it returns the Neutron
    clients manager and not the one in the Tempest repo.
  - Updated it from the Tempest repo so that it uses the new way
    to manage credentials (Since it now uses the Tempest test base
    class and not our out of date forked copy).

Change-Id: I4f9193dfe26f2d36985cb480a98709ec182a2f7b
2016-01-29 11:31:27 -05:00
Mathieu Rohon
3b2b277979 bump the min tox version to 2.3.1
When tox 2.3.0 uses the tox.ini provided by neutron,
the following bug is hitten :
https://bitbucket.org/hpk42/tox/issues/181
We need to set the min version of tox to 2.3.1.

Change-Id: If2c3f4f534ff23a1f649cebea15e945563173544
Closes-bug: #1535725
2016-01-19 14:06:44 +00:00
chen-li
45238be4d6 Pass environment variables of proxy to tox
When a development environment is under a proxy, tox is failed
even if environment variables of the proxy are set. This is a
new feature above tox 2.0, you can check it from [1].

This patch fix this problem.

[1]. https://tox.readthedocs.org/en/latest/example/basic.html#passing-down-environment-variables

Change-Id: I9dae04de7053773cb5ba13a809145b86cb149614
2016-01-13 18:51:18 +00:00
Jenkins
68276dc961 Merge "Allow tox to pass more arguments to ostestr command" 2016-01-12 22:20:10 +00:00
Jenkins
ecc108caa8 Merge "Revert "Revert "Revert "Remove TEMPEST_CONFIG_DIR in the api tox env"""" 2016-01-06 20:48:14 +00:00
Ihar Hrachyshka
380e384f18 Revert "Revert "Revert "Remove TEMPEST_CONFIG_DIR in the api tox env"""
This reverts commit be63289c273fa02159a6958e0b456d5fda217431.

Yes, it's a third order revert. Ain't it cool?

Now that tox 2.3.1 is used in gate, and it is expected to fix the issue
that we originally hacked around here, let's revert to the previous
code.

For the least, it makes API target executable locally without the need
to set TEMPEST_CONFIG_DIR in the external environment.

Also bump minimal tox version to 2.3 to avoid users hitting the old
issue with their tox 2.2.* package.

Change-Id: Ic64cb466d117ad39436cb1d079c8f5657260da2c
Related-Bug: #1515335
2016-01-06 16:14:26 +00:00
Martin Hickey
074268f74c Add test for Neutron object versions
Adds a test to Neutron to check object versions for any changes
to objects. It prompts the developer to update the version of the
changed object. It uses oslo.versionedobjects.

Change-Id: I99454b28ae0b5fa663354eeccdf709d4030a280b
Co-Authored-By: Ryan Rossiter <rlrossit@us.ibm.com>
2016-01-06 10:34:03 +00:00
gong yong sheng
240facf9e6 Allow tox to pass more arguments to ostestr command
Co-Authored-By: Kevin Benton <blak111@gmail.com>
Change-Id: Ie9969e0a5254ab5dd33b287f6d3120362b73edd7
Closes-bug: #1490389
2016-01-05 14:53:19 -08:00
armando-migliaccio
fce50f3beb Run functional gate jobs in a constrained environment
This patch modifies the gate hooks to run jobs with upper constraints.

Change-Id: I9eb1eb8e61381e9bb45678af8a24fa88a99e2c8f
2015-12-22 19:31:59 -08:00
Jenkins
899a2ba26c Merge "Improve tox to show coverage report on same window" 2015-12-17 11:32:26 +00:00
Manjeet Singh Bhatia
f9b3edb97d Improve tox to show coverage report on same window
with this patch coverage report will be shown with the results when
tox -e cover will be run

Change-Id: Ic975e65f1b3abadd90075e7f040c605e3740990f
2015-12-15 21:36:45 +00:00
Ondřej Nový
9b0bc3e5b3 Deprecated tox -downloadcache option removed
Caching is enabled by default from pip version 6.0

More info:
https://testrun.org/tox/latest/config.html#confval-downloadcache=path
https://pip.pypa.io/en/stable/reference/pip_install/#caching

Change-Id: I1778135d68a4bf96da3a0c0e4660172d1f13d16b
2015-12-11 21:34:32 +01:00
Assaf Muller
dd5a8e4166 Tox: Remove fullstack env, keep only dsvm-fullstack
In the functional tests we have 'functional' and 'dsvm-functional'
venvs. The difference is that dsvm-functional requires can run
rootwrap commands on the machine. In the fullstack context,
not running rootwrap commands doesn't make sense, as fullstack
tests are explicitly and solely integration tests.

Change-Id: I1e85537d137a1b773198facbb835a65b6d0ce9b4
2015-12-05 17:17:13 -05:00
Doug Wiegley
14e7b932fc Allow multiple imports for both ways of doing i18n
Disallowing the old way makes the transition period messier than
it needs to be.

Change-Id: I687f18f0f0554f3198320a94f2e664896e88fbfc
2015-12-03 12:53:55 -07:00
Doug Wiegley
dd726ed494 Move i18n to _i18n, as per oslo_i18n guidelines
- This does NOT break other projects that rely on neutron.i18n,
  as this change includes a debtcollector shim to maintain those
  older entry points, until they can migrate.
- Also updates _i18n.py to the latest pattern defined by oslo_i18n
- Guidance and template are from the reference:
  http://docs.openstack.org/developer/oslo.i18n/usage.html

Partially-Closes-Bug: #1519493
Change-Id: I1aa3a5fd837d9156da4643a367013c869ed8bf9d
2015-12-01 19:29:10 -07:00
Martin Hickey
71190773e1 Automatically generate neutron core configuration files
This adds a new tox environment, genconfig, which generates sample
neutron core configuration file using oslo-config-generator.

Updates to some configuration option help messages to reflect useful
details that were missing in the code but were present in config files.

It also adds details to devref on how to update config files.

Partially-Implements: blueprint autogen-neutron-conf-file

DocImpact

Change-Id: I1c6dc4e7d479f1b7c755597caded24a0f018c712
Closes-bug: #1199963
Co-Authored-By: Louis Taylor <louis@kragniz.eu>
2015-11-27 15:22:59 +00:00
Doug Hellmann
54c390cb32 force releasenotes warnings to be treated as errors
Change-Id: I48ecfbd8992a81fe13838e6c353195188f7cb3cd
Related-Bug: #1519912
2015-11-25 18:32:17 +00:00
Ihar Hrachyshka
143b3dc286 tox: pass TEMPEST_CONFIG_DIR envvar into api target environment
Currently, API job skips all tests because TEMPEST_CONFIG_DIR is not set
properly. The environment variable was hardcoded to
/opt/stack/tempest/etc before, and since that's the location for tempest
configuration files that was used in gate, it worked fine there.

But after we were forced to remove the hardcoded value from the file due
to regression in tox 2.2.0+ (If3742b6eabe295a5aaeb4901c55909a70c451698),
it was neither hardcoded, nor passed from the external gate environment.

Note that since tox 2.0.0, the tool does not pass all envvars into tox
targets, but require explicit specification of the list of variables
that should be allowed into the target environment, using passenv
directive.

So that's what the patch does: it allows TEMPEST_CONFIG_DIR to get into
api tox target, which should be enough to make the API job avoid
skipping all tests.

Users are still required to set TEMPEST_CONFIG_DIR variable locally if
they want to execute the suite locally.

Closes-Bug: #1518632
Change-Id: Ia7dcc6785390a6012c7ba16a14573aa44f2b6fb5
2015-11-24 15:19:07 +01:00
Jenkins
7286260f85 Merge "Require tox >= 2.0" 2015-11-13 19:06:55 +00:00
Ihar Hrachyshka
be63289c27 Revert "Revert "Remove TEMPEST_CONFIG_DIR in the api tox env""
This reverts commit a3154b03ac60df586bd8fd67f03c20327f2dde41.

The revert was merged too quickly, without waiting for tox project to fix us.
The gate passed for the revert only because infra folks removed images
that had new tox in them. We will be broken by the next images though.

Change-Id: I148c80e5b9512fee280ecbf3ca7498ddf1cfd96d
2015-11-12 21:57:16 +00:00
Ihar Hrachyshka
497932466c Require tox >= 2.0
We use passenv in the file, and as per [1], it's introduced in tox 2.0.

[1] https://testrun.org/tox/latest/config.html#confval-passenv=SPACE-SEPARATED-GLOBNAMES

Change-Id: I97f1f903dec10b4a91fc27d62990ab974c5831bf
2015-11-12 22:22:28 +01:00
Ihar Hrachyshka
a3154b03ac Revert "Remove TEMPEST_CONFIG_DIR in the api tox env"
This reverts commit a32e31a624cf5190ed267effed8f7db2c9919949.

We should be able to merge the revert back once tox project fixes the
bug* on their side.

* https://bitbucket.org/hpk42/tox/issues/285/tox-220-breaks-some-toxini-config-files

Change-Id: Ic1f5391c687b2683cbaab210c543022aa1f26e83
Related-Bug: #1515335
2015-11-11 20:18:14 +01:00