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
This commit is contained in:
Daniel Mellado 2016-01-29 11:30:25 +00:00
parent 2397fd0d5c
commit c56918027a
47 changed files with 89 additions and 46 deletions

View File

@ -283,7 +283,7 @@ the hypervisor appropriately.
API Tests
~~~~~~~~~
API tests (neutron/tests/api/) are intended to ensure the function
API tests (neutron/tests/tempest/api/) are intended to ensure the function
and stability of the Neutron API. As much as possible, changes to
this path should not be made at the same time as changes to the code
to limit the potential for introducing backwards-incompatible changes,
@ -297,7 +297,7 @@ be made about implementation. Only the contract defined by Neutron's REST API
should be validated, and all interaction with the daemon should be via
a REST client.
neutron/tests/api was copied from the Tempest project. At the time, there was
neutron/tests/tempest/api was copied from the Tempest project. At the time, there was
an overlap of tests between the Tempest and Neutron repositories. This overlap
was then eliminated by carving out a subset of resources that belong to
Tempest, with the rest in Neutron.
@ -525,6 +525,11 @@ TEMPEST_CONFIG_DIR before invoking tox: ::
export TEMPEST_CONFIG_DIR=[path to dir containing tempest.conf]
tox -e api
You may also utilize Neutron's Tempest plugin by going to the Tempest directory
and executing:
tox -e all-plugin neutron
Running Individual Tests
~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -412,4 +412,4 @@ API tests
API tests for basic CRUD operations for ports, networks, policies, and rules were added in:
* neutron.tests.api.test_qos
* neutron.tests.tempest.api.test_qos

View File

@ -3,8 +3,8 @@ WARNING
The files under this path were copied from tempest as part of the move
of the api tests, and they will be removed as required over time to
minimize the depedency on the tempest testing framework.
While it exists, only neutron.tests.api and neutron.tests.retargetable should
be importing files from this path. neutron.tests.tempest.config uses
minimize the dependency on the tempest testing framework.
While it exists, only neutron.tests.tempest.api and neutron.tests.retargetable
should be importing files from this path. neutron.tests.tempest.config uses
the global cfg.CONF instance and importing it outside of the api tests
has the potential to break Neutron's use of cfg.CONF.

View File

@ -15,7 +15,7 @@
from neutron.tests.tempest.common import tempest_fixtures
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class AgentManagementTestJSON(base.BaseAdminNetworkTest):

View File

@ -14,7 +14,7 @@
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest):

View File

@ -16,8 +16,8 @@
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base
from neutron.tests.api import base_security_groups as base_security
from neutron.tests.tempest.api import base
from neutron.tests.tempest.api import base_security_groups as base_security
class PortSecurityAdminTests(base_security.BaseSecGroupTest,

View File

@ -16,7 +16,7 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):

View File

@ -18,7 +18,7 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -15,7 +15,7 @@
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import exceptions
AGENT_TYPE = 'L3 agent'

View File

@ -17,7 +17,7 @@ import six
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class QuotasTest(base.BaseAdminNetworkTest):

View File

@ -16,7 +16,7 @@
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base_routers as base
from neutron.tests.tempest.api import base_routers as base
class RoutersTestDVR(base.BaseRouterTest):

View File

@ -21,7 +21,7 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class SharedNetworksTest(base.BaseAdminNetworkTest):

View File

@ -18,7 +18,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import clients
from neutron.tests.tempest.api import clients
from neutron.tests.tempest import config
from neutron.tests.tempest import exceptions

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class BaseRouterTest(base.BaseAdminNetworkTest):

View File

@ -15,7 +15,7 @@
from tempest.lib.common.utils import data_utils
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class BaseSecGroupTest(base.BaseNetworkTest):

View File

@ -16,7 +16,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
ADDRESS_SCOPE_NAME = 'smoke-address-scope'

View File

@ -16,7 +16,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import test_address_scopes
from neutron.tests.tempest.api import test_address_scopes
class AddressScopeTestNegative(test_address_scopes.AddressScopeTestBase):

View File

@ -16,7 +16,7 @@
import netaddr
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -16,7 +16,7 @@
from oslo_config import cfg
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class TestAutoAllocatedTopology(base.BaseAdminNetworkTest):

View File

@ -18,7 +18,7 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest.common import tempest_fixtures as fixtures
CONF = config.CONF

View File

@ -15,7 +15,7 @@
import netaddr
from tempest.lib import exceptions as lib_exc
from neutron.tests.api import test_bgp_speaker_extensions as test_base
from neutron.tests.tempest.api import test_bgp_speaker_extensions as test_base
from tempest import test

View File

@ -18,7 +18,7 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.common import constants
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -17,8 +17,8 @@ import ddt
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base
from neutron.tests.api import base_security_groups as base_security
from neutron.tests.tempest.api import base
from neutron.tests.tempest.api import base_security_groups as base_security
FAKE_IP = '10.0.0.1'
FAKE_MAC = '00:25:64:e8:19:dd'

View File

@ -16,7 +16,7 @@
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):

View File

@ -15,7 +15,7 @@
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class TestFlavorsJson(base.BaseAdminNetworkTest):

View File

@ -16,7 +16,7 @@
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -18,7 +18,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -15,7 +15,7 @@
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class MeteringTestJSON(base.BaseAdminNetworkTest):

View File

@ -19,7 +19,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
from neutron_lib import constants as lib_constants

View File

@ -15,7 +15,7 @@
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -15,7 +15,7 @@
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class PortsTestJSON(base.BaseNetworkTest):

View File

@ -19,7 +19,7 @@ from tempest import test
import testtools
from neutron.services.qos import qos_consts
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class QosTestJSON(base.BaseAdminNetworkTest):

View File

@ -18,7 +18,7 @@ import six
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base_routers as base
from neutron.tests.tempest.api import base_routers as base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -18,7 +18,7 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from neutron.tests.api import base_routers as base
from neutron.tests.tempest.api import base_routers as base
class DvrRoutersNegativeTest(base.BaseRouterTest):

View File

@ -16,7 +16,7 @@
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base_security_groups as base
from neutron.tests.tempest.api import base_security_groups as base
class SecGroupTest(base.BaseSecGroupTest):

View File

@ -16,7 +16,7 @@
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import base_security_groups as base
from neutron.tests.tempest.api import base_security_groups as base
from neutron.tests.tempest import config
CONF = config.CONF

View File

@ -12,7 +12,7 @@
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class ServiceTypeManagementTest(base.BaseNetworkTest):

View File

@ -16,7 +16,7 @@
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
SUBNETPOOL_NAME = 'smoke-subnetpool'
SUBNET_NAME = 'smoke-subnet'

View File

@ -20,7 +20,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from neutron.tests.api import test_subnetpools
from neutron.tests.tempest.api import test_subnetpools
SUBNETPOOL_NAME = 'smoke-subnetpool'

View File

@ -15,7 +15,7 @@ import copy
from tempest.lib.common.utils import data_utils
from tempest import test
from neutron.tests.api import base
from neutron.tests.tempest.api import base
class TestTimeStamp(base.BaseAdminNetworkTest):

View File

@ -0,0 +1,36 @@
# Copyright 2015
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from tempest import config
from tempest.test_discover import plugins
import neutron
class NeutronTempestPlugin(plugins.TempestPlugin):
def load_tests(self):
base_path = os.path.split(os.path.dirname(
os.path.abspath(neutron.__file__)))[0]
test_dir = "neutron/tests/tempest"
full_test_dir = os.path.join(base_path, test_dir)
return full_test_dir, base_path
def register_opts(self, conf):
pass
def get_opt_lists(self):
pass

View File

@ -163,6 +163,8 @@ neutron.agent.firewall_drivers =
iptables = neutron.agent.linux.iptables_firewall:IptablesFirewallDriver
iptables_hybrid = neutron.agent.linux.iptables_firewall:OVSHybridIptablesFirewallDriver
openvswitch = neutron.agent.linux.openvswitch_firewall:OVSFirewallDriver
tempest.test_plugins =
neutron_tests = neutron.tests.tempest.plugin:NeutronTempestPlugin
[build_sphinx]
all_files = 1

View File

@ -21,7 +21,7 @@ commands =
basepython = python2.7
passenv = {[testenv]passenv} TEMPEST_CONFIG_DIR
setenv = {[testenv]setenv}
OS_TEST_PATH=./neutron/tests/api
OS_TEST_PATH=./neutron/tests/tempest/api
TEMPEST_CONFIG_DIR={env:TEMPEST_CONFIG_DIR:/opt/stack/tempest/etc}
OS_TEST_API_WITH_REST=1