Commit Graph

13 Commits (0634dcc6d0f08c18c69a2c360a2c5c0581ec7bb6)

Author SHA1 Message Date
Rodolfo Alonso Hernandez 7e0c44e21f Remove references to unittest2 library
Library "unittest2" has not released a new version since
Jun 30 2015 [1]. Neutron should remove the references to
this library and point to "unittest" instead.


Change-Id: I7d55adc262280c0c2f13b9b81ecc582e1729afa0
Closes-Bug: #1859190
3 years ago
Ihar Hrachyshka 31e1aeb66b Forbid importing neutron.tests.* from outside tests subtree
neutron-sanity-check tool was importing neutron.tests.base module, which
may be not present on some systems (f.e. RDO splits neutron/tests/
subtree in a separate python-neutron-tests package). It made the tool
not usable in some setups.

This is not the first time when we by mistake import from
neutron.tests.* and break distributions. It's time to stop it by
proactively forbidding that pattern via a new hacking check.

Some functions were moved from neutron.tests.base to
neutron.common.utils to fulfill the need requirement. They were moved
using debtcollector, no current consumers should be affected.

Closes-Bug: #1621782
Change-Id: I790777ddcbd1b02218b3db54ae3d5c931d72d4fa
7 years ago
Mike Bayer 546ba377db Restore MySQL and Postgresql functional testing
The oslo.db opportunistic test fixtures were not being
used effectively and the MySQL / PG databases were not
being used.  This patch restores working patterns against
oslo.db.  Additionally, the migration level tests have also
been updated to make use of oslo.db provisioning functionality
and unused methods have been removed.

The current approach makes use of oslo.db provisioning constructs
directly, as well as some semi-private attribute access within
oslo.db enginefacade, in order to work around some issues
that have arisen in oslo.db's test_base.
A new release of oslo.db will provide
public API points to resolve pending issues, and to
allow neutron's use cases here which will
also be of general applicability to openstack projects.

Closes-bug: #1594898

Change-Id: Ie27cf174fa24c2f479af47335d9ae139fb7d159a
7 years ago
Jenkins e0c2122222 Merge "Use unittest2 uniformly across Neutron" 7 years ago
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
7 years ago
Henry Gessau 4148a347b3 Use constants from neutron-lib
With this we enable the deprecation warnings by default.

Related-Blueprint: neutron-lib

Change-Id: I5b9e53751dd164010e5bbeb15f534ac0fe2a5105
7 years ago
Jeremy Stanley d23a59f1c8 Override opportunistic database tests to PyMySQL
Set the OS_TEST_DBAPI_ADMIN_CONNECTION override variable so that
oslo.db opportunistic detection will know to use PyMySQL until
I12b32dc097a121bd43991bc38dd4d289b65e86c1 makes it the default

This change removes previous code[1] enabling PyMySQL use.

[1] Ic5c1d12ab75443e1cc290a7447eeb4b452b4a9dd

Change-Id: Ic39feee0248f2ffabdba26f3779ab40a8f3838e6
Co-Authored-By: Victor Sergeyev <>
Co-Authored-By: Cedric Brandily <>
8 years ago
Cedric Brandily b370c69b75 Ensure no "db" related functional/fullstack tests are skipped in the gate
Currently neutron uses MySQLTestCase[1] and
PostgreSQLOpportunisticTestCase[2] for functional and fullstack tests
using a real MySQL/PostgreSQL database. These classes skip tests when
the db is unavailable (db not installed/configured, missing packages,
etc.) which is fine when tests are runned by developers but not when
runned by the gate jobs.

This change updates MySQLTestCase[1] and defines PostgreSQLTestCase[1]
as PostgreSQL oslo.db test class wrapper: when the db is unavailable,
these classes ensure tests will:

* fail in the gate (dsvm-functional, dsvm-fullstack jobs),
* be skipped by default otherwise (functional, fullstack jobs).

[1] neutron.tests.common.base
[2] oslo_db.sqlalchemy.test_base

Closes-Bug: #1404093
Change-Id: I77b12e728ce9a7b0222c3df081842635f6375a3e
8 years ago
Cedric Brandily 278a5fce29 Use PyMySQL in MySQL related functional/fullstack tests
mysql-python driver has been replaced by PyMySQL driver[1] in neutron
code but MySQL related functional/fullstack tests try to use
mysql-python driver because of MySQLOpportunisticTestCase[2] and tests
are skipped because mysql-python driver is no more available.

This change provides a backend implementation for mysql+pymysql, a base
base testcase MySQLTestCase[2] using mysql+pymysql implementation
(currently oslo.db provides none of them but will in the future) and
replaces MySQLOpportunisticTestCase with MySQLTestCase.

[1] I73e0fdb6eca70e7d029a40a2f6f17a7c0797a21d
[2] neutron.tests.common.base

Closes-Bug: #1463980
Change-Id: Ic5c1d12ab75443e1cc290a7447eeb4b452b4a9dd
8 years ago
Cedric Brandily 27df3e9fb9 Ensure no "agent" functional tests are skipped in the gate
Some "agent" functional tests[1] can be skipped if some requirements are
not satisfied in order to allow developers to run functional tests on
various environments. These tests should not be skipped in the gate.

This change defines the decorator no_skip_on_missing_deps[2] to ensure
no "agent" functional tests are skipped in the gate. More precisely
no_skip_on_missing_deps transforms a skipTest into an error in:

* dsvm-functional and dsvm-fullstack jobs,
* functional and fullstack jobs when OS_FAIL_ON_MISSING_DEPS is
  evaluated as True.

The change enlarges OS_FAIL_ON_MISSING_DEPS environment variable scope
(ie: missing dependencies + system requirements).

[1] in neutron.tests.functional
[2] in neutron.tests.common.base

Change-Id: Iacd4a5ef249fc1d7c75135ead9d0cf99d8a98a06
Closes-Bug: #1459844
8 years ago
John Schwarz 833ce26860 create_resource should return maximum length str
Previously, get_rand_name(max_length, prefix) returned a randomized
suffix integer which was concatenated to the end of the given prefix.
Effectively, the suffix was any decimal number between 1 and
0x7fffffff, so multiple calls to the function could return strings with
different length. This is unexpected since running an already
randomized name into the same function shouldn't return a different

The suggested solution is to actually fill all the space needed until
the string is 'max_length' in size. Also, a check is added to
create_resource to make sure that it only generates a new port name if
the input prefix is less than the maximum device name and if the prefix
is long enough, don't generate a random port suffix.

Change-Id: I0d5a20c676f627bce2a377e3c451043150ca734c
8 years ago
Maru Newby a314544def Simplify base test cases
Previous changes (Ifa270536481fcb19c476c9c62d89e6c5cae36ca1 and
I44251db399cd73390a9d1931a7f253662002ba10) separated out test setup
that had to import Neutron to allow the api tests to run.  The api
tests previously imported Tempest, and errors would result if both
Neutron and Tempest were imported in the same test run.  Now that the
api tests do not import Tempest, the base test cases can be simplified
by reversing the referenced changes.

A dependent change to neutron-fwaas removes reference to testlib
plugin: I0f2098cfd380fb6978d643cfd09bcc5cf8ddbdb9

Change-Id: Ifca5615680217818b8c5e8fc2dee5d089fbd9532
8 years ago
Cedric Brandily e7becaf36c Prepare Base(OVS)LinuxTestCase transformation in helpers
This change prepares to transform BaseLinuxTestCase[1] and
BaseOVSLinuxTestCase[1] methods into helpers in a follow-up change.

[1] in neutron.tests.functional.agent.linux.base

Change-Id: Ie04f33283544e79c1296aa1de5b6946049ae53b9
8 years ago