373 Commits

Author SHA1 Message Date
Ihar Hrachyshka
705f1da49b Disable new N537 hacking check from next neutron-lib
Once a new neutron-lib release will be cut off, the new hacking check
will break the pep8 target because the code still uses translation
markers for log messages.

Instead of fixing all remaining log messages and hoping no new messages
land before neutron-lib release, we temporarily disable the check; we
will reenable it back once we have a neutron-lib release in gate that we
can validate the patch removing translation markers against.

Change-Id: Icef59a03184473476e0657334bcc30dc7bf4f9ff
2017-04-18 12:19:39 -07:00
Ihar Hrachyshka
9c1e48e79d Switch to neutron-lib hacking factory
This allows us to kill a bunch of in-tree checks. There are still some
checks that are either not yet in the library, or don't belong there in
the first place, so we still stick to our own factory, just reusing
whatever is there in neutron-lib.

This change skips some new checks. We gotta figure out what to do with
those, that will belong in a separate follow-up.

Change-Id: Ifeb40ec0e0c4ca623b33a6b9f500dec15cec4de0
2017-04-13 07:41:25 -07:00
Brian Haley
a0552e75e3 Fix bashate warnings
Three ((value++)) lines are generating this bashate warning:
E043: Arithmetic compound has inconsistent return semantics

This will now be an error when running pep8 checks.

Trivialfix

Change-Id: If7a63e550d5d27fe6716cc63c85426cd2250732f
2017-03-07 13:32:04 -05:00
Jenkins
a0d84499a3 Merge "Adding a code coverage threshold" 2017-02-27 23:02:40 +00:00
Victor Morales
49bec33d45 Adding a code coverage threshold
The current implementation of the coverage code job gate only fails
when the report is not created. This change pretends to set a
minimum reasonable percentage of code coverage(82%).

Change-Id: Ia30116fff8b834486bde93c329543fce15be429f
2017-02-25 06:30:36 +00:00
Victor Morales
a14439549f Add bashate support
Bashate is a style checker program for bash scripts.  This addition
improves the quality of the current bash scripts and ensures that
any future change will follow the same standards.

Change-Id: Ia346f77632d4ac7beb288fa3aacea221d7969c87
2017-02-25 06:29:55 +00:00
Ihar Hrachyshka
ad99fb0ddb Enable dstat for in-gate functional and fullstack test runs
This may become handy when debugging gate failures like job or test case
or ovsdb timeouts, to see the load of the machine, as well as to
understand whether the machine was e.g. locked by its hypervisor during
test run.

Instead of using devstack as a library, we just enable the service in
local.conf [[localrc]], and then call ./stack.sh.

Now that we install some pypi packages into the system, and since
functional targets were using those system packages, post_gate_hook.sh
broke failing to locate subunit-2to1 script in the tox env directory. To
fix that, we disable sitepackages= for all functional tox targets. This
was enabled back in the times when we attempted to install neutron for
the functional job using devstack [1], and we no longer do it, so it
should be ok to stick to all packages from the tox venv.

[1] Icc38cacd69bc5843ccfcc60237a7102df6d8597f

Change-Id: I73857f63f512e26d595c61a20ec5bf22d2fb0da7
2017-02-11 01:32:24 +00:00
Gary Kotton
36f55b33f8 Remove python 3.4 support
The gating on python 3.4 is restricted to <= Mitaka. There is no
need to continue to keep these settings.

From Newton onwards we are gating on python 3.5.

Change-Id: Ib6e6c62212796f493bb99fb3c5e39ab4f2e45cfc
2017-01-08 05:37:48 -08:00
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