From 21bef562c23d96fe41daeedeb43c0bb2d1c53ed0 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Mon, 6 Apr 2015 21:53:39 +0000 Subject: [PATCH] Reorganize plugin test modules This change moves plugin test modules to conform to the new rules on unit test tree structure (see TESTING.rst). Vendor plugin paths continue to be ignored, and unit test modules that test features instead of modules are also ignored pending their removal to the functional test tree. Change-Id: I482c377ca72ffd58692ad84bd9692356513e4c98 Closes-Bug: #1440834 --- neutron/tests/retargetable/base.py | 4 ++-- .../plugins/linuxbridge/agent/__init__.py | 0 .../test_linuxbridge_neutron_agent.py} | 0 ...ism_driver.py => test_mechanism_arista.py} | 0 .../base_type_tunnel.py} | 0 .../{test_cisco_apic_common.py => base.py} | 0 ...t_cisco_apic_sync.py => test_apic_sync.py} | 0 ...opology_agent.py => test_apic_topology.py} | 2 +- ...anism_driver.py => test_mechanism_apic.py} | 2 +- .../{test_mechanism_ncs.py => test_driver.py} | 2 +- .../unit/plugins/ml2/drivers/ext_test.py | 2 +- .../freescale/test_mechanism_fslsdn.py | 10 +++++----- .../plugins/ml2/drivers/l2pop/__init__.py | 0 .../test_mech_driver.py} | 2 +- .../unit/plugins/ml2/drivers/mlnx/__init__.py | 0 .../ml2/drivers/{ => mlnx}/test_mech_mlnx.py | 0 .../ml2/drivers/opendaylight/__init__.py | 0 .../opendaylight/test_driver.py} | 2 +- .../plugins/ml2/{ => drivers}/test_helpers.py | 0 .../{ => drivers}/test_mech_linuxbridge.py | 0 .../{ => drivers}/test_mech_openvswitch.py | 0 .../ml2/{ => drivers}/test_type_flat.py | 0 .../ml2/{ => drivers}/test_type_gre.py | 12 ++++++------ .../ml2/{ => drivers}/test_type_local.py | 0 .../ml2/{ => drivers}/test_type_vlan.py | 0 .../ml2/{ => drivers}/test_type_vxlan.py | 12 ++++++------ .../{test_extension.py => fake_extension.py} | 8 ++++---- .../unit/plugins/ml2/test_agent_scheduler.py | 8 ++++---- .../ml2/{db/test_ml2_db.py => test_db.py} | 0 .../unit/plugins/ml2/test_ext_portsecurity.py | 4 ++-- .../plugins/ml2/test_extension_driver_api.py | 6 +++--- .../{test_ml2_plugin.py => test_plugin.py} | 0 .../ml2/{test_rpcapi.py => test_rpc.py} | 0 .../plugins/openvswitch/agent/__init__.py | 0 .../{ => agent}/test_ovs_neutron_agent.py | 0 .../plugins/sriovnicagent/common/__init__.py | 0 .../test_config.py} | 0 ...utron_agent.py => test_sriov_nic_agent.py} | 0 .../unit/services/l3_router/test_l3_apic.py | 3 +-- tools/check_unit_test_structure.sh | 19 ++++++++++++++++++- 40 files changed, 57 insertions(+), 41 deletions(-) create mode 100644 neutron/tests/unit/plugins/linuxbridge/agent/__init__.py rename neutron/tests/unit/plugins/linuxbridge/{test_lb_neutron_agent.py => agent/test_linuxbridge_neutron_agent.py} (100%) rename neutron/tests/unit/plugins/ml2/drivers/arista/{test_arista_mechanism_driver.py => test_mechanism_arista.py} (100%) rename neutron/tests/unit/plugins/ml2/{test_type_tunnel.py => drivers/base_type_tunnel.py} (100%) rename neutron/tests/unit/plugins/ml2/drivers/cisco/apic/{test_cisco_apic_common.py => base.py} (100%) rename neutron/tests/unit/plugins/ml2/drivers/cisco/apic/{test_cisco_apic_sync.py => test_apic_sync.py} (100%) rename neutron/tests/unit/plugins/ml2/drivers/cisco/apic/{test_cisco_apic_topology_agent.py => test_apic_topology.py} (99%) rename neutron/tests/unit/plugins/ml2/drivers/cisco/apic/{test_cisco_apic_mechanism_driver.py => test_mechanism_apic.py} (99%) rename neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/{test_mechanism_ncs.py => test_driver.py} (95%) create mode 100644 neutron/tests/unit/plugins/ml2/drivers/l2pop/__init__.py rename neutron/tests/unit/plugins/ml2/drivers/{test_l2population.py => l2pop/test_mech_driver.py} (99%) create mode 100644 neutron/tests/unit/plugins/ml2/drivers/mlnx/__init__.py rename neutron/tests/unit/plugins/ml2/drivers/{ => mlnx}/test_mech_mlnx.py (100%) create mode 100644 neutron/tests/unit/plugins/ml2/drivers/opendaylight/__init__.py rename neutron/tests/unit/plugins/ml2/{test_mechanism_odl.py => drivers/opendaylight/test_driver.py} (98%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_helpers.py (100%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_mech_linuxbridge.py (100%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_mech_openvswitch.py (100%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_type_flat.py (100%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_type_gre.py (94%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_type_local.py (100%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_type_vlan.py (100%) rename neutron/tests/unit/plugins/ml2/{ => drivers}/test_type_vxlan.py (93%) rename neutron/tests/unit/plugins/ml2/extensions/{test_extension.py => fake_extension.py} (92%) rename neutron/tests/unit/plugins/ml2/{db/test_ml2_db.py => test_db.py} (100%) rename neutron/tests/unit/plugins/ml2/{test_ml2_plugin.py => test_plugin.py} (100%) rename neutron/tests/unit/plugins/ml2/{test_rpcapi.py => test_rpc.py} (100%) create mode 100644 neutron/tests/unit/plugins/openvswitch/agent/__init__.py rename neutron/tests/unit/plugins/openvswitch/{ => agent}/test_ovs_neutron_agent.py (100%) create mode 100644 neutron/tests/unit/plugins/sriovnicagent/common/__init__.py rename neutron/tests/unit/plugins/sriovnicagent/{test_sriov_agent_config.py => common/test_config.py} (100%) rename neutron/tests/unit/plugins/sriovnicagent/{test_sriov_neutron_agent.py => test_sriov_nic_agent.py} (100%) diff --git a/neutron/tests/retargetable/base.py b/neutron/tests/retargetable/base.py index a149f961c..ed80c4020 100644 --- a/neutron/tests/retargetable/base.py +++ b/neutron/tests/retargetable/base.py @@ -29,7 +29,7 @@ import testscenarios from neutron.tests import base as tests_base from neutron.tests.retargetable import client_fixtures -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin # Each plugin must add a class to plugin_configurations that can configure the @@ -39,7 +39,7 @@ from neutron.tests.unit.plugins.ml2 import test_ml2_plugin # TODO(marun) Discover plugin conf via a metaclass plugin_configurations = [ - test_ml2_plugin.Ml2ConfFixture(), + test_plugin.Ml2ConfFixture(), ] diff --git a/neutron/tests/unit/plugins/linuxbridge/agent/__init__.py b/neutron/tests/unit/plugins/linuxbridge/agent/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/tests/unit/plugins/linuxbridge/test_lb_neutron_agent.py b/neutron/tests/unit/plugins/linuxbridge/agent/test_linuxbridge_neutron_agent.py similarity index 100% rename from neutron/tests/unit/plugins/linuxbridge/test_lb_neutron_agent.py rename to neutron/tests/unit/plugins/linuxbridge/agent/test_linuxbridge_neutron_agent.py diff --git a/neutron/tests/unit/plugins/ml2/drivers/arista/test_arista_mechanism_driver.py b/neutron/tests/unit/plugins/ml2/drivers/arista/test_mechanism_arista.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/drivers/arista/test_arista_mechanism_driver.py rename to neutron/tests/unit/plugins/ml2/drivers/arista/test_mechanism_arista.py diff --git a/neutron/tests/unit/plugins/ml2/test_type_tunnel.py b/neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_type_tunnel.py rename to neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py diff --git a/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_common.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/base.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_common.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/base.py diff --git a/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_sync.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_apic_sync.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_sync.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_apic_sync.py diff --git a/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_apic_topology.py similarity index 99% rename from neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_apic_topology.py index 89fefbaea..016f16453 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_apic_topology.py @@ -22,7 +22,7 @@ sys.modules["apicapi"] = mock.Mock() from neutron.plugins.ml2.drivers.cisco.apic import apic_topology from neutron.tests import base from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import ( - test_cisco_apic_common as mocked) + base as mocked) NOTIFIER = ('neutron.plugins.ml2.drivers.cisco.apic.' 'apic_topology.ApicTopologyServiceNotifierApi') diff --git a/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_mechanism_apic.py similarity index 99% rename from neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_mechanism_apic.py index 50cba5fc8..f59fedcf2 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_mechanism_apic.py @@ -25,7 +25,7 @@ from neutron.plugins.ml2.drivers.cisco.apic import mechanism_apic as md from neutron.plugins.ml2.drivers import type_vlan # noqa from neutron.tests import base from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import ( - test_cisco_apic_common as mocked) + base as mocked) HOST_ID1 = 'ubuntu' diff --git a/neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_driver.py similarity index 95% rename from neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_driver.py index d9fe09ad2..5678925c5 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py +++ b/neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_driver.py @@ -14,7 +14,7 @@ # under the License. from neutron.plugins.ml2.drivers.cisco.ncs import driver -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin class NCSTestCase(test_plugin.Ml2PluginV2TestCase): diff --git a/neutron/tests/unit/plugins/ml2/drivers/ext_test.py b/neutron/tests/unit/plugins/ml2/drivers/ext_test.py index 02b79dc58..90c0f72ba 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ext_test.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ext_test.py @@ -30,7 +30,7 @@ from neutron.tests.unit.plugins.ml2 import extensions as test_extensions class TestExtensionDriverBase(driver_api.ExtensionDriver): - _supported_extension_aliases = 'test_extension' + _supported_extension_aliases = 'fake_extension' def initialize(self): extensions.append_api_extensions_path(test_extensions.__path__) diff --git a/neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py b/neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py index 04b0e8fb1..f4ac15f30 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py +++ b/neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py @@ -19,13 +19,13 @@ from oslo_config import cfg from neutron.extensions import portbindings from neutron.plugins.ml2.drivers.freescale import mechanism_fslsdn from neutron.tests import base -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin """Unit testing for Freescale SDN mechanism driver.""" -class TestFslSdnMechDriverV2(test_ml2_plugin.Ml2PluginV2TestCase): +class TestFslSdnMechDriverV2(test_plugin.Ml2PluginV2TestCase): _mechanism_drivers = ['fslsdn'] """Testing mechanism driver with ML2 plugin.""" @@ -41,18 +41,18 @@ class TestFslSdnMechDriverV2(test_ml2_plugin.Ml2PluginV2TestCase): super(TestFslSdnMechDriverV2, self).setUp() -class TestFslSdnMechDriverNetworksV2(test_ml2_plugin.TestMl2NetworksV2, +class TestFslSdnMechDriverNetworksV2(test_plugin.TestMl2NetworksV2, TestFslSdnMechDriverV2): pass -class TestFslSdnMechDriverPortsV2(test_ml2_plugin.TestMl2PortsV2, +class TestFslSdnMechDriverPortsV2(test_plugin.TestMl2PortsV2, TestFslSdnMechDriverV2): VIF_TYPE = portbindings.VIF_TYPE_OVS CAP_PORT_FILTER = True -class TestFslSdnMechDriverSubnetsV2(test_ml2_plugin.TestMl2SubnetsV2, +class TestFslSdnMechDriverSubnetsV2(test_plugin.TestMl2SubnetsV2, TestFslSdnMechDriverV2): pass diff --git a/neutron/tests/unit/plugins/ml2/drivers/l2pop/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/l2pop/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/tests/unit/plugins/ml2/drivers/test_l2population.py b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py similarity index 99% rename from neutron/tests/unit/plugins/ml2/drivers/test_l2population.py rename to neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py index d0f972158..69e3b3c50 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/test_l2population.py +++ b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py @@ -35,7 +35,7 @@ from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc from neutron.plugins.ml2 import managers from neutron.plugins.ml2 import rpc from neutron.tests import base -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin HOST = 'my_l2_host' L2_AGENT = { diff --git a/neutron/tests/unit/plugins/ml2/drivers/mlnx/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/mlnx/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/tests/unit/plugins/ml2/drivers/test_mech_mlnx.py b/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/drivers/test_mech_mlnx.py rename to neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py diff --git a/neutron/tests/unit/plugins/ml2/drivers/opendaylight/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/opendaylight/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/tests/unit/plugins/ml2/test_mechanism_odl.py b/neutron/tests/unit/plugins/ml2/drivers/opendaylight/test_driver.py similarity index 98% rename from neutron/tests/unit/plugins/ml2/test_mechanism_odl.py rename to neutron/tests/unit/plugins/ml2/drivers/opendaylight/test_driver.py index 89161ac20..03b835467 100644 --- a/neutron/tests/unit/plugins/ml2/test_mechanism_odl.py +++ b/neutron/tests/unit/plugins/ml2/drivers/opendaylight/test_driver.py @@ -17,7 +17,7 @@ import sys import mock from neutron import context -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin with mock.patch.dict(sys.modules, diff --git a/neutron/tests/unit/plugins/ml2/test_helpers.py b/neutron/tests/unit/plugins/ml2/drivers/test_helpers.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_helpers.py rename to neutron/tests/unit/plugins/ml2/drivers/test_helpers.py diff --git a/neutron/tests/unit/plugins/ml2/test_mech_linuxbridge.py b/neutron/tests/unit/plugins/ml2/drivers/test_mech_linuxbridge.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_mech_linuxbridge.py rename to neutron/tests/unit/plugins/ml2/drivers/test_mech_linuxbridge.py diff --git a/neutron/tests/unit/plugins/ml2/test_mech_openvswitch.py b/neutron/tests/unit/plugins/ml2/drivers/test_mech_openvswitch.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_mech_openvswitch.py rename to neutron/tests/unit/plugins/ml2/drivers/test_mech_openvswitch.py diff --git a/neutron/tests/unit/plugins/ml2/test_type_flat.py b/neutron/tests/unit/plugins/ml2/drivers/test_type_flat.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_type_flat.py rename to neutron/tests/unit/plugins/ml2/drivers/test_type_flat.py diff --git a/neutron/tests/unit/plugins/ml2/test_type_gre.py b/neutron/tests/unit/plugins/ml2/drivers/test_type_gre.py similarity index 94% rename from neutron/tests/unit/plugins/ml2/test_type_gre.py rename to neutron/tests/unit/plugins/ml2/drivers/test_type_gre.py index fba76f92c..01f36ab46 100644 --- a/neutron/tests/unit/plugins/ml2/test_type_gre.py +++ b/neutron/tests/unit/plugins/ml2/drivers/test_type_gre.py @@ -23,8 +23,8 @@ from neutron.db import api as db_api from neutron.plugins.common import constants as p_const from neutron.plugins.ml2 import config from neutron.plugins.ml2.drivers import type_gre -from neutron.tests.unit.plugins.ml2 import test_rpcapi -from neutron.tests.unit.plugins.ml2 import test_type_tunnel +from neutron.tests.unit.plugins.ml2.drivers import base_type_tunnel +from neutron.tests.unit.plugins.ml2 import test_rpc from neutron.tests.unit import testlib_api @@ -44,7 +44,7 @@ def _get_allocation(session, gre_id): gre_id=gre_id).one() -class GreTypeTest(test_type_tunnel.TunnelTypeTestMixin, +class GreTypeTest(base_type_tunnel.TunnelTypeTestMixin, testlib_api.SqlTestCase): DRIVER_CLASS = type_gre.GreTypeDriver TYPE = p_const.TYPE_GRE @@ -151,13 +151,13 @@ class GreTypeTest(test_type_tunnel.TunnelTypeTestMixin, self.assertEqual(0, self.driver.get_mtu('physnet1')) -class GreTypeMultiRangeTest(test_type_tunnel.TunnelTypeMultiRangeTestMixin, +class GreTypeMultiRangeTest(base_type_tunnel.TunnelTypeMultiRangeTestMixin, testlib_api.SqlTestCase): DRIVER_CLASS = type_gre.GreTypeDriver -class GreTypeRpcCallbackTest(test_type_tunnel.TunnelRpcCallbackTestMixin, - test_rpcapi.RpcCallbacksTestCase, +class GreTypeRpcCallbackTest(base_type_tunnel.TunnelRpcCallbackTestMixin, + test_rpc.RpcCallbacksTestCase, testlib_api.SqlTestCase): DRIVER_CLASS = type_gre.GreTypeDriver TYPE = p_const.TYPE_GRE diff --git a/neutron/tests/unit/plugins/ml2/test_type_local.py b/neutron/tests/unit/plugins/ml2/drivers/test_type_local.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_type_local.py rename to neutron/tests/unit/plugins/ml2/drivers/test_type_local.py diff --git a/neutron/tests/unit/plugins/ml2/test_type_vlan.py b/neutron/tests/unit/plugins/ml2/drivers/test_type_vlan.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_type_vlan.py rename to neutron/tests/unit/plugins/ml2/drivers/test_type_vlan.py diff --git a/neutron/tests/unit/plugins/ml2/test_type_vxlan.py b/neutron/tests/unit/plugins/ml2/drivers/test_type_vxlan.py similarity index 93% rename from neutron/tests/unit/plugins/ml2/test_type_vxlan.py rename to neutron/tests/unit/plugins/ml2/drivers/test_type_vxlan.py index b76b0094f..b59f01180 100644 --- a/neutron/tests/unit/plugins/ml2/test_type_vxlan.py +++ b/neutron/tests/unit/plugins/ml2/drivers/test_type_vxlan.py @@ -18,8 +18,8 @@ import mock from neutron.plugins.common import constants as p_const from neutron.plugins.ml2 import config from neutron.plugins.ml2.drivers import type_vxlan -from neutron.tests.unit.plugins.ml2 import test_rpcapi -from neutron.tests.unit.plugins.ml2 import test_type_tunnel +from neutron.tests.unit.plugins.ml2.drivers import base_type_tunnel +from neutron.tests.unit.plugins.ml2 import test_rpc from neutron.tests.unit import testlib_api @@ -31,7 +31,7 @@ VXLAN_UDP_PORT_ONE = 9999 VXLAN_UDP_PORT_TWO = 8888 -class VxlanTypeTest(test_type_tunnel.TunnelTypeTestMixin, +class VxlanTypeTest(base_type_tunnel.TunnelTypeTestMixin, testlib_api.SqlTestCase): DRIVER_CLASS = type_vxlan.VxlanTypeDriver TYPE = p_const.TYPE_VXLAN @@ -119,13 +119,13 @@ class VxlanTypeTest(test_type_tunnel.TunnelTypeTestMixin, self.assertEqual(0, self.driver.get_mtu('physnet1')) -class VxlanTypeMultiRangeTest(test_type_tunnel.TunnelTypeMultiRangeTestMixin, +class VxlanTypeMultiRangeTest(base_type_tunnel.TunnelTypeMultiRangeTestMixin, testlib_api.SqlTestCase): DRIVER_CLASS = type_vxlan.VxlanTypeDriver -class VxlanTypeRpcCallbackTest(test_type_tunnel.TunnelRpcCallbackTestMixin, - test_rpcapi.RpcCallbacksTestCase, +class VxlanTypeRpcCallbackTest(base_type_tunnel.TunnelRpcCallbackTestMixin, + test_rpc.RpcCallbacksTestCase, testlib_api.SqlTestCase): DRIVER_CLASS = type_vxlan.VxlanTypeDriver TYPE = p_const.TYPE_VXLAN diff --git a/neutron/tests/unit/plugins/ml2/extensions/test_extension.py b/neutron/tests/unit/plugins/ml2/extensions/fake_extension.py similarity index 92% rename from neutron/tests/unit/plugins/ml2/extensions/test_extension.py rename to neutron/tests/unit/plugins/ml2/extensions/fake_extension.py index c48c0e7d0..fdc94c128 100644 --- a/neutron/tests/unit/plugins/ml2/extensions/test_extension.py +++ b/neutron/tests/unit/plugins/ml2/extensions/fake_extension.py @@ -39,15 +39,15 @@ EXTENDED_ATTRIBUTES_2_0 = { } -class Test_extension(extensions.ExtensionDescriptor): +class Fake_extension(extensions.ExtensionDescriptor): @classmethod def get_name(cls): - return "ML2 test extension" + return "ML2 fake extension" @classmethod def get_alias(cls): - return "test_extension" + return "fake_extension" @classmethod def get_description(cls): @@ -56,7 +56,7 @@ class Test_extension(extensions.ExtensionDescriptor): @classmethod def get_namespace(cls): return ("http://docs.openstack.org/ext/neutron/ml2/test/" - "test_extension/api/v1.0") + "fake_extension/api/v1.0") @classmethod def get_updated(cls): diff --git a/neutron/tests/unit/plugins/ml2/test_agent_scheduler.py b/neutron/tests/unit/plugins/ml2/test_agent_scheduler.py index a55645cd6..ed6de34c4 100644 --- a/neutron/tests/unit/plugins/ml2/test_agent_scheduler.py +++ b/neutron/tests/unit/plugins/ml2/test_agent_scheduler.py @@ -13,24 +13,24 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin from neutron.tests.unit.plugins.openvswitch import test_agent_scheduler class Ml2AgentSchedulerTestCase( test_agent_scheduler.OvsAgentSchedulerTestCase): - plugin_str = test_ml2_plugin.PLUGIN_NAME + plugin_str = test_plugin.PLUGIN_NAME l3_plugin = ('neutron.services.l3_router.' 'l3_router_plugin.L3RouterPlugin') class Ml2L3AgentNotifierTestCase( test_agent_scheduler.OvsL3AgentNotifierTestCase): - plugin_str = test_ml2_plugin.PLUGIN_NAME + plugin_str = test_plugin.PLUGIN_NAME l3_plugin = ('neutron.services.l3_router.' 'l3_router_plugin.L3RouterPlugin') class Ml2DhcpAgentNotifierTestCase( test_agent_scheduler.OvsDhcpAgentNotifierTestCase): - plugin_str = test_ml2_plugin.PLUGIN_NAME + plugin_str = test_plugin.PLUGIN_NAME diff --git a/neutron/tests/unit/plugins/ml2/db/test_ml2_db.py b/neutron/tests/unit/plugins/ml2/test_db.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/db/test_ml2_db.py rename to neutron/tests/unit/plugins/ml2/test_db.py diff --git a/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py b/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py index 9b0d2eead..6180ff10e 100644 --- a/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py +++ b/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py @@ -15,10 +15,10 @@ from neutron.plugins.ml2 import config from neutron.tests.unit.extensions import test_portsecurity as test_psec -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin -class PSExtDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase, +class PSExtDriverTestCase(test_plugin.Ml2PluginV2TestCase, test_psec.TestPortSecurity): _extension_drivers = ['port_security'] diff --git a/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py b/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py index 5fc422163..92e4957e9 100644 --- a/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py +++ b/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py @@ -17,10 +17,10 @@ from neutron import context from neutron import manager from neutron.plugins.ml2 import config from neutron.tests.unit.plugins.ml2.drivers import ext_test -from neutron.tests.unit.plugins.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2 import test_plugin -class ExtensionDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase): +class ExtensionDriverTestCase(test_plugin.Ml2PluginV2TestCase): _extension_drivers = ['test'] @@ -128,7 +128,7 @@ class ExtensionDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase): self.assertTrue(ext_port_dict.called) -class DBExtensionDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase): +class DBExtensionDriverTestCase(test_plugin.Ml2PluginV2TestCase): _extension_drivers = ['testdb'] def setUp(self): diff --git a/neutron/tests/unit/plugins/ml2/test_ml2_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_ml2_plugin.py rename to neutron/tests/unit/plugins/ml2/test_plugin.py diff --git a/neutron/tests/unit/plugins/ml2/test_rpcapi.py b/neutron/tests/unit/plugins/ml2/test_rpc.py similarity index 100% rename from neutron/tests/unit/plugins/ml2/test_rpcapi.py rename to neutron/tests/unit/plugins/ml2/test_rpc.py diff --git a/neutron/tests/unit/plugins/openvswitch/agent/__init__.py b/neutron/tests/unit/plugins/openvswitch/agent/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/tests/unit/plugins/openvswitch/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py similarity index 100% rename from neutron/tests/unit/plugins/openvswitch/test_ovs_neutron_agent.py rename to neutron/tests/unit/plugins/openvswitch/agent/test_ovs_neutron_agent.py diff --git a/neutron/tests/unit/plugins/sriovnicagent/common/__init__.py b/neutron/tests/unit/plugins/sriovnicagent/common/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/tests/unit/plugins/sriovnicagent/test_sriov_agent_config.py b/neutron/tests/unit/plugins/sriovnicagent/common/test_config.py similarity index 100% rename from neutron/tests/unit/plugins/sriovnicagent/test_sriov_agent_config.py rename to neutron/tests/unit/plugins/sriovnicagent/common/test_config.py diff --git a/neutron/tests/unit/plugins/sriovnicagent/test_sriov_neutron_agent.py b/neutron/tests/unit/plugins/sriovnicagent/test_sriov_nic_agent.py similarity index 100% rename from neutron/tests/unit/plugins/sriovnicagent/test_sriov_neutron_agent.py rename to neutron/tests/unit/plugins/sriovnicagent/test_sriov_nic_agent.py diff --git a/neutron/tests/unit/services/l3_router/test_l3_apic.py b/neutron/tests/unit/services/l3_router/test_l3_apic.py index 536c10e7a..24431b5d8 100644 --- a/neutron/tests/unit/services/l3_router/test_l3_apic.py +++ b/neutron/tests/unit/services/l3_router/test_l3_apic.py @@ -21,8 +21,7 @@ sys.modules["apicapi"] = mock.Mock() from neutron.plugins.ml2.drivers.cisco.apic import mechanism_apic as md from neutron.services.l3_router import l3_apic -from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import ( - test_cisco_apic_common as mocked) +from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import base as mocked from neutron.tests.unit import testlib_api diff --git a/tools/check_unit_test_structure.sh b/tools/check_unit_test_structure.sh index 9c250fe61..1e8a2362f 100755 --- a/tools/check_unit_test_structure.sh +++ b/tools/check_unit_test_structure.sh @@ -11,7 +11,24 @@ test_path=$neutron_path/$base_test_path test_files=$(find ${test_path} -iname 'test_*.py') ignore_regexes=( - "^plugins.*$" + # The following vendor plugins are not required to confrm to the + # structural requirements. + "^plugins/brocade.*$" + "^plugins/cisco.*$" + "^plugins/embrane.*$" + "^plugins/ibm.*$" + "^plugins/oneconvergence.*$" + # The following open source plugin tests are not actually unit + # tests and are ignored pending their relocation to the functional + # test tree. + "^plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py$" + "^plugins/ml2/test_security_group.py$" + "^plugins/ml2/test_port_binding.py$" + "^plugins/ml2/test_extension_driver_api.py$" + "^plugins/ml2/test_ext_portsecurity.py$" + "^plugins/ml2/test_agent_scheduler.py$" + "^plugins/openvswitch/test_ovs_tunnel.py$" + "^plugins/openvswitch/test_agent_scheduler.py$" ) error_count=0 -- 2.45.2