From 1105782e3914f601b8f4be64939816b1afe8fb54 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Sat, 4 Apr 2015 00:22:05 +0000 Subject: [PATCH] Reorganize unit test tree This change ensures that the structure of the unit test tree matches that of the code tree to make it obvious where to find tests for a given module. A check is added to the pep8 job to protect against regressions. The plugin test paths are relocated to neutron/tests/unit/plugins but are otherwise ignored for now. Change-Id: If307593259139171be21a71c58e3a34bf148cc7f Partial-Bug: #1440834 --- TESTING.rst | 33 ++++++++++++ neutron/tests/etc/api-paste.ini.test | 2 +- neutron/tests/retargetable/base.py | 2 +- .../unit/_test_extension_portbindings.py | 4 +- .../common/test_config.py} | 0 .../unit/{brocade => agent/dhcp}/__init__.py | 0 .../dhcp/test_agent.py} | 0 .../l3/test_agent.py} | 0 .../unit/agent/{ => l3}/test_dvr_fip_ns.py | 0 .../l3/test_link_local_allocator.py} | 0 .../l3}/test_router_processing_queue.py | 0 .../linux/test_daemon.py} | 0 .../linux/test_dhcp.py} | 0 .../linux/test_external_process.py} | 0 .../linux/test_interface.py} | 0 .../linux/test_ip_lib.py} | 0 .../linux}/test_iptables_firewall.py | 4 +- .../linux}/test_iptables_manager.py | 0 .../metadata/test_agent.py} | 0 .../metadata/test_namespace_proxy.py} | 0 .../{test_agent_rpc.py => agent/test_rpc.py} | 0 .../test_securitygroups_rpc.py} | 4 +- .../{ => api/rpc/handlers}/test_dhcp_rpc.py | 0 .../test_api_common.py} | 0 .../tests/unit/{ => api}/test_extensions.py | 8 +-- .../tests/unit/{cisco => api/v2}/__init__.py | 0 .../unit/{ => api/v2}/test_attributes.py | 0 .../{test_api_v2.py => api/v2/test_base.py} | 2 +- .../v2/test_resource.py} | 0 .../unit/{cisco/n1kv => cmd}/__init__.py | 0 .../unit/{ => cmd}/test_netns_cleanup.py | 0 .../tests/unit/{ => cmd}/test_ovs_cleanup.py | 0 .../unit/{embrane => common}/__init__.py | 0 .../tests/unit/{ => common}/test_config.py | 0 .../test_ipv6_utils.py} | 0 .../test_log.py} | 0 .../test_rpc.py} | 0 .../test_utils.py} | 0 ...est_db_metering.py => test_metering_db.py} | 7 +-- .../{test_agent_db.py => test_agents_db.py} | 0 .../test_allowedaddresspairs_db.py} | 7 +-- .../test_db_base_plugin_v2.py} | 2 +- ...{test_l3_ha_db.py => test_l3_hamode_db.py} | 0 .../test_migration.py} | 0 .../tests/unit/{hyperv => debug}/__init__.py | 0 .../test_commands.py} | 0 .../base.py} | 6 +-- .../test_agent.py} | 10 ++-- .../test_external_net.py} | 10 ++-- .../test_extra_dhcp_opt.py} | 6 +-- .../test_extraroute.py} | 12 ++--- .../test_l3.py} | 28 +++++----- .../test_l3_ext_gw_mode.py} | 19 +++---- .../test_netmtu.py} | 6 +-- .../test_portsecurity.py} | 12 ++--- .../test_providernet.py} | 14 ++--- .../test_quotasv2.py} | 4 +- .../test_securitygroup.py} | 6 +-- .../unit/{ => extensions}/test_servicetype.py | 12 ++--- neutron/tests/unit/ipam/test_subnet_alloc.py | 4 +- .../{test_notifiers_nova.py => test_nova.py} | 0 .../tests/unit/{ibm => plugins}/__init__.py | 0 .../{ipam => plugins/brocade}/__init__.py | 0 .../{ => plugins}/brocade/test_brocade_db.py | 2 +- .../brocade/test_brocade_plugin.py | 2 +- .../brocade/test_brocade_vlan.py | 0 .../cisco}/__init__.py | 0 .../{ml2 => plugins/cisco/n1kv}/__init__.py | 0 .../{ => plugins}/cisco/n1kv/fake_client.py | 0 .../{ => plugins}/cisco/n1kv/test_n1kv_db.py | 2 +- .../cisco/n1kv/test_n1kv_plugin.py | 16 +++--- .../{ => plugins}/cisco/test_network_db.py | 0 .../{ml2/db => plugins/embrane}/__init__.py | 0 .../embrane/test_embrane_l3_plugin.py | 2 +- .../embrane/test_embrane_neutron_plugin.py | 2 +- .../drivers => plugins/hyperv}/__init__.py | 0 .../arista => plugins/ibm}/__init__.py | 0 .../{ => plugins}/ibm/test_sdnve_agent.py | 0 .../unit/{ => plugins}/ibm/test_sdnve_api.py | 0 .../{ => plugins}/ibm/test_sdnve_plugin.py | 6 +-- .../cisco => plugins/linuxbridge}/__init__.py | 0 .../linuxbridge/test_lb_neutron_agent.py | 0 .../cisco/apic => plugins/ml2}/__init__.py | 0 .../{ => plugins}/ml2/_test_mech_agent.py | 0 .../cisco/ncs => plugins/ml2/db}/__init__.py | 0 .../unit/{ => plugins}/ml2/db/test_ml2_db.py | 0 .../{ => plugins}/ml2/db/test_ml2_dvr_db.py | 0 .../ml2/drivers}/__init__.py | 0 .../ml2/drivers/arista}/__init__.py | 0 .../arista/test_arista_mechanism_driver.py | 0 .../ml2/drivers/cisco}/__init__.py | 0 .../ml2/drivers/cisco/apic}/__init__.py | 0 .../cisco/apic/test_cisco_apic_common.py | 0 .../apic/test_cisco_apic_mechanism_driver.py | 2 +- .../cisco/apic/test_cisco_apic_sync.py | 0 .../apic/test_cisco_apic_topology_agent.py | 2 +- .../ml2/drivers/cisco/ncs}/__init__.py | 0 .../drivers/cisco/ncs/test_mechanism_ncs.py | 2 +- .../{ => plugins}/ml2/drivers/ext_test.py | 2 +- .../ml2/drivers/freescale}/__init__.py | 0 .../freescale/test_mechanism_fslsdn.py | 2 +- .../ml2/drivers/mech_fake_agent.py | 0 .../ml2/drivers/mech_sriov}/__init__.py | 0 .../mech_sriov/test_mech_sriov_nic_switch.py | 2 +- .../ml2/drivers/mechanism_logger.py | 0 .../ml2/drivers/mechanism_test.py | 0 .../ml2/drivers/test_l2population.py | 2 +- .../ml2/drivers/test_mech_mlnx.py | 2 +- .../unit/plugins/ml2/extensions/__init__.py | 0 .../ml2/extensions/test_extension.py | 0 .../{ => plugins}/ml2/test_agent_scheduler.py | 4 +- .../{ => plugins}/ml2/test_driver_context.py | 0 .../ml2/test_ext_portsecurity.py | 4 +- .../ml2/test_extension_driver_api.py | 4 +- .../unit/{ => plugins}/ml2/test_helpers.py | 0 .../ml2/test_mech_linuxbridge.py | 2 +- .../ml2/test_mech_openvswitch.py | 2 +- .../{ => plugins}/ml2/test_mechanism_odl.py | 2 +- .../unit/{ => plugins}/ml2/test_ml2_plugin.py | 15 +++--- .../{ => plugins}/ml2/test_port_binding.py | 2 +- .../unit/{ => plugins}/ml2/test_rpcapi.py | 0 .../{ => plugins}/ml2/test_security_group.py | 10 ++-- .../unit/{ => plugins}/ml2/test_type_flat.py | 0 .../unit/{ => plugins}/ml2/test_type_gre.py | 4 +- .../unit/{ => plugins}/ml2/test_type_local.py | 0 .../{ => plugins}/ml2/test_type_tunnel.py | 0 .../unit/{ => plugins}/ml2/test_type_vlan.py | 0 .../unit/{ => plugins}/ml2/test_type_vxlan.py | 4 +- .../unit/plugins/oneconvergence/__init__.py | 0 .../oneconvergence/test_nvsd_agent.py | 0 .../oneconvergence/test_nvsd_plugin.py | 8 +-- .../oneconvergence/test_nvsdlib.py | 0 .../oneconvergence/test_plugin_helper.py | 0 .../oneconvergence/test_security_group.py | 7 +-- .../unit/plugins/opencontrail/__init__.py | 0 .../opencontrail/test_contrail_plugin.py | 10 ++-- .../unit/plugins/openvswitch/__init__.py | 0 .../openvswitch/test_agent_scheduler.py | 24 ++++----- .../openvswitch/test_ovs_dvr_neutron_agent.py | 0 .../openvswitch/test_ovs_neutron_agent.py | 0 .../openvswitch/test_ovs_tunnel.py | 0 .../unit/plugins/sriovnicagent/__init__.py | 0 .../sriovnicagent/test_eswitch_manager.py | 0 .../sriovnicagent/test_pci_lib.py | 0 .../sriovnicagent/test_sriov_agent_config.py | 0 .../sriovnicagent/test_sriov_neutron_agent.py | 0 neutron/tests/unit/scheduler/__init__.py | 0 .../test_dhcp_agent_scheduler.py} | 0 .../test_l3_agent_scheduler.py} | 12 ++--- ...test_l3_apic_plugin.py => test_l3_apic.py} | 2 +- .../unit/services/metering/agents/__init__.py | 0 .../{ => agents}/test_metering_agent.py | 0 ...st_iptables_driver.py => test_iptables.py} | 4 +- .../services/metering/test_metering_plugin.py | 34 ++++++------ .../test_provider_configuration.py | 0 ...est_neutron_context.py => test_context.py} | 0 neutron/tests/unit/{ipam => }/test_ipam.py | 0 ...est_neutron_manager.py => test_manager.py} | 6 +-- neutron/tests/unit/tests/__init__.py | 0 .../test_base.py} | 0 .../{ => tests}/test_post_mortem_debug.py | 0 setup.cfg | 10 ++-- tools/check_unit_test_structure.sh | 52 +++++++++++++++++++ tools/misc-sanity-checks.sh | 2 +- tox.ini | 1 + 165 files changed, 294 insertions(+), 203 deletions(-) rename neutron/tests/unit/{test_agent_config.py => agent/common/test_config.py} (100%) rename neutron/tests/unit/{brocade => agent/dhcp}/__init__.py (100%) rename neutron/tests/unit/{test_dhcp_agent.py => agent/dhcp/test_agent.py} (100%) rename neutron/tests/unit/{test_l3_agent.py => agent/l3/test_agent.py} (100%) rename neutron/tests/unit/agent/{ => l3}/test_dvr_fip_ns.py (100%) rename neutron/tests/unit/{test_l3_dvr.py => agent/l3/test_link_local_allocator.py} (100%) rename neutron/tests/unit/{ => agent/l3}/test_router_processing_queue.py (100%) rename neutron/tests/unit/{test_linux_daemon.py => agent/linux/test_daemon.py} (100%) rename neutron/tests/unit/{test_linux_dhcp.py => agent/linux/test_dhcp.py} (100%) rename neutron/tests/unit/{test_linux_external_process.py => agent/linux/test_external_process.py} (100%) rename neutron/tests/unit/{test_linux_interface.py => agent/linux/test_interface.py} (100%) rename neutron/tests/unit/{test_linux_ip_lib.py => agent/linux/test_ip_lib.py} (100%) rename neutron/tests/unit/{ => agent/linux}/test_iptables_firewall.py (99%) rename neutron/tests/unit/{ => agent/linux}/test_iptables_manager.py (100%) rename neutron/tests/unit/{test_metadata_agent.py => agent/metadata/test_agent.py} (100%) rename neutron/tests/unit/{test_metadata_namespace_proxy.py => agent/metadata/test_namespace_proxy.py} (100%) rename neutron/tests/unit/{test_agent_rpc.py => agent/test_rpc.py} (100%) rename neutron/tests/unit/{test_security_groups_rpc.py => agent/test_securitygroups_rpc.py} (99%) rename neutron/tests/unit/{ => api/rpc/handlers}/test_dhcp_rpc.py (100%) rename neutron/tests/unit/{test_api_api_common.py => api/test_api_common.py} (100%) rename neutron/tests/unit/{ => api}/test_extensions.py (99%) rename neutron/tests/unit/{cisco => api/v2}/__init__.py (100%) rename neutron/tests/unit/{ => api/v2}/test_attributes.py (100%) rename neutron/tests/unit/{test_api_v2.py => api/v2/test_base.py} (99%) rename neutron/tests/unit/{test_api_v2_resource.py => api/v2/test_resource.py} (100%) rename neutron/tests/unit/{cisco/n1kv => cmd}/__init__.py (100%) rename neutron/tests/unit/{ => cmd}/test_netns_cleanup.py (100%) rename neutron/tests/unit/{ => cmd}/test_ovs_cleanup.py (100%) rename neutron/tests/unit/{embrane => common}/__init__.py (100%) rename neutron/tests/unit/{ => common}/test_config.py (100%) rename neutron/tests/unit/{test_ipv6.py => common/test_ipv6_utils.py} (100%) rename neutron/tests/unit/{test_common_log.py => common/test_log.py} (100%) rename neutron/tests/unit/{test_rpc_service.py => common/test_rpc.py} (100%) rename neutron/tests/unit/{test_common_utils.py => common/test_utils.py} (100%) rename neutron/tests/unit/db/metering/{test_db_metering.py => test_metering_db.py} (98%) rename neutron/tests/unit/db/{test_agent_db.py => test_agents_db.py} (100%) rename neutron/tests/unit/{test_extension_allowedaddresspairs.py => db/test_allowedaddresspairs_db.py} (98%) rename neutron/tests/unit/{test_db_plugin.py => db/test_db_base_plugin_v2.py} (99%) rename neutron/tests/unit/db/{test_l3_ha_db.py => test_l3_hamode_db.py} (100%) rename neutron/tests/unit/{test_db_migration.py => db/test_migration.py} (100%) rename neutron/tests/unit/{hyperv => debug}/__init__.py (100%) rename neutron/tests/unit/{test_debug_commands.py => debug/test_commands.py} (100%) rename neutron/tests/unit/{test_api_v2_extension.py => extensions/base.py} (96%) rename neutron/tests/unit/{test_agent_ext_plugin.py => extensions/test_agent.py} (97%) rename neutron/tests/unit/{test_extension_ext_net.py => extensions/test_external_net.py} (96%) rename neutron/tests/unit/{test_extension_extradhcpopts.py => extensions/test_extra_dhcp_opt.py} (98%) rename neutron/tests/unit/{test_extension_extraroute.py => extensions/test_extraroute.py} (98%) rename neutron/tests/unit/{test_l3_plugin.py => extensions/test_l3.py} (99%) rename neutron/tests/unit/{test_extension_ext_gw_mode.py => extensions/test_l3_ext_gw_mode.py} (96%) rename neutron/tests/unit/{test_extension_netmtu.py => extensions/test_netmtu.py} (93%) rename neutron/tests/unit/{test_extension_portsecurity.py => extensions/test_portsecurity.py} (98%) rename neutron/tests/unit/{test_extension_pnet.py => extensions/test_providernet.py} (94%) rename neutron/tests/unit/{test_quota_ext.py => extensions/test_quotasv2.py} (99%) rename neutron/tests/unit/{test_extension_security_group.py => extensions/test_securitygroup.py} (99%) rename neutron/tests/unit/{ => extensions}/test_servicetype.py (96%) rename neutron/tests/unit/notifiers/{test_notifiers_nova.py => test_nova.py} (100%) rename neutron/tests/unit/{ibm => plugins}/__init__.py (100%) rename neutron/tests/unit/{ipam => plugins/brocade}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/brocade/test_brocade_db.py (98%) rename neutron/tests/unit/{ => plugins}/brocade/test_brocade_plugin.py (97%) rename neutron/tests/unit/{ => plugins}/brocade/test_brocade_vlan.py (100%) rename neutron/tests/unit/{linuxbridge => plugins/cisco}/__init__.py (100%) rename neutron/tests/unit/{ml2 => plugins/cisco/n1kv}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/cisco/n1kv/fake_client.py (100%) rename neutron/tests/unit/{ => plugins}/cisco/n1kv/test_n1kv_db.py (99%) rename neutron/tests/unit/{ => plugins}/cisco/n1kv/test_n1kv_plugin.py (99%) rename neutron/tests/unit/{ => plugins}/cisco/test_network_db.py (100%) rename neutron/tests/unit/{ml2/db => plugins/embrane}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/embrane/test_embrane_l3_plugin.py (93%) rename neutron/tests/unit/{ => plugins}/embrane/test_embrane_neutron_plugin.py (97%) rename neutron/tests/unit/{ml2/drivers => plugins/hyperv}/__init__.py (100%) rename neutron/tests/unit/{ml2/drivers/arista => plugins/ibm}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ibm/test_sdnve_agent.py (100%) rename neutron/tests/unit/{ => plugins}/ibm/test_sdnve_api.py (100%) rename neutron/tests/unit/{ => plugins}/ibm/test_sdnve_plugin.py (94%) rename neutron/tests/unit/{ml2/drivers/cisco => plugins/linuxbridge}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/linuxbridge/test_lb_neutron_agent.py (100%) rename neutron/tests/unit/{ml2/drivers/cisco/apic => plugins/ml2}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/_test_mech_agent.py (100%) rename neutron/tests/unit/{ml2/drivers/cisco/ncs => plugins/ml2/db}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/db/test_ml2_db.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/db/test_ml2_dvr_db.py (100%) rename neutron/tests/unit/{ml2/drivers/freescale => plugins/ml2/drivers}/__init__.py (100%) rename neutron/tests/unit/{ml2/drivers/mech_sriov => plugins/ml2/drivers/arista}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/arista/test_arista_mechanism_driver.py (100%) rename neutron/tests/unit/{ml2/extensions => plugins/ml2/drivers/cisco}/__init__.py (100%) rename neutron/tests/unit/{oneconvergence => plugins/ml2/drivers/cisco/apic}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/cisco/apic/test_cisco_apic_common.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py (99%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/cisco/apic/test_cisco_apic_sync.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py (99%) rename neutron/tests/unit/{opencontrail => plugins/ml2/drivers/cisco/ncs}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/cisco/ncs/test_mechanism_ncs.py (95%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/ext_test.py (99%) rename neutron/tests/unit/{openvswitch => plugins/ml2/drivers/freescale}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/freescale/test_mechanism_fslsdn.py (99%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/mech_fake_agent.py (100%) rename neutron/tests/unit/{sriovnicagent => plugins/ml2/drivers/mech_sriov}/__init__.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py (99%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/mechanism_logger.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/mechanism_test.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/test_l2population.py (99%) rename neutron/tests/unit/{ => plugins}/ml2/drivers/test_mech_mlnx.py (98%) create mode 100644 neutron/tests/unit/plugins/ml2/extensions/__init__.py rename neutron/tests/unit/{ => plugins}/ml2/extensions/test_extension.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_agent_scheduler.py (90%) rename neutron/tests/unit/{ => plugins}/ml2/test_driver_context.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_ext_portsecurity.py (89%) rename neutron/tests/unit/{ => plugins}/ml2/test_extension_driver_api.py (98%) rename neutron/tests/unit/{ => plugins}/ml2/test_helpers.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_mech_linuxbridge.py (97%) rename neutron/tests/unit/{ => plugins}/ml2/test_mech_openvswitch.py (98%) rename neutron/tests/unit/{ => plugins}/ml2/test_mechanism_odl.py (98%) rename neutron/tests/unit/{ => plugins}/ml2/test_ml2_plugin.py (99%) rename neutron/tests/unit/{ => plugins}/ml2/test_port_binding.py (99%) rename neutron/tests/unit/{ => plugins}/ml2/test_rpcapi.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_security_group.py (95%) rename neutron/tests/unit/{ => plugins}/ml2/test_type_flat.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_type_gre.py (98%) rename neutron/tests/unit/{ => plugins}/ml2/test_type_local.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_type_tunnel.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_type_vlan.py (100%) rename neutron/tests/unit/{ => plugins}/ml2/test_type_vxlan.py (97%) create mode 100644 neutron/tests/unit/plugins/oneconvergence/__init__.py rename neutron/tests/unit/{ => plugins}/oneconvergence/test_nvsd_agent.py (100%) rename neutron/tests/unit/{ => plugins}/oneconvergence/test_nvsd_plugin.py (94%) rename neutron/tests/unit/{ => plugins}/oneconvergence/test_nvsdlib.py (100%) rename neutron/tests/unit/{ => plugins}/oneconvergence/test_plugin_helper.py (100%) rename neutron/tests/unit/{ => plugins}/oneconvergence/test_security_group.py (94%) create mode 100644 neutron/tests/unit/plugins/opencontrail/__init__.py rename neutron/tests/unit/{ => plugins}/opencontrail/test_contrail_plugin.py (97%) create mode 100644 neutron/tests/unit/plugins/openvswitch/__init__.py rename neutron/tests/unit/{ => plugins}/openvswitch/test_agent_scheduler.py (98%) rename neutron/tests/unit/{ => plugins}/openvswitch/test_ovs_dvr_neutron_agent.py (100%) rename neutron/tests/unit/{ => plugins}/openvswitch/test_ovs_neutron_agent.py (100%) rename neutron/tests/unit/{ => plugins}/openvswitch/test_ovs_tunnel.py (100%) create mode 100644 neutron/tests/unit/plugins/sriovnicagent/__init__.py rename neutron/tests/unit/{ => plugins}/sriovnicagent/test_eswitch_manager.py (100%) rename neutron/tests/unit/{ => plugins}/sriovnicagent/test_pci_lib.py (100%) rename neutron/tests/unit/{ => plugins}/sriovnicagent/test_sriov_agent_config.py (100%) rename neutron/tests/unit/{ => plugins}/sriovnicagent/test_sriov_neutron_agent.py (100%) create mode 100644 neutron/tests/unit/scheduler/__init__.py rename neutron/tests/unit/{test_dhcp_scheduler.py => scheduler/test_dhcp_agent_scheduler.py} (100%) rename neutron/tests/unit/{test_l3_schedulers.py => scheduler/test_l3_agent_scheduler.py} (99%) rename neutron/tests/unit/services/l3_router/{test_l3_apic_plugin.py => test_l3_apic.py} (98%) create mode 100644 neutron/tests/unit/services/metering/agents/__init__.py rename neutron/tests/unit/services/metering/{ => agents}/test_metering_agent.py (100%) rename neutron/tests/unit/services/metering/drivers/{test_iptables_driver.py => test_iptables.py} (99%) rename neutron/tests/unit/{ => services}/test_provider_configuration.py (100%) rename neutron/tests/unit/{test_neutron_context.py => test_context.py} (100%) rename neutron/tests/unit/{ipam => }/test_ipam.py (100%) rename neutron/tests/unit/{test_neutron_manager.py => test_manager.py} (96%) create mode 100644 neutron/tests/unit/tests/__init__.py rename neutron/tests/unit/{test_basetestcase.py => tests/test_base.py} (100%) rename neutron/tests/unit/{ => tests}/test_post_mortem_debug.py (100%) create mode 100755 tools/check_unit_test_structure.sh diff --git a/TESTING.rst b/TESTING.rst index 7b1d9f23698..a4f1388d020 100644 --- a/TESTING.rst +++ b/TESTING.rst @@ -24,6 +24,39 @@ fixes that are submitted also have tests to prove that they stay fixed! In addition, before proposing for merge, all of the current tests should be passing. +Structure of the unit test tree +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The structure of the unit test tree should match the structure of the +code tree, e.g. :: + + - target module: neutron.agent.utils + + - test module: neutron.tests.unit.agent.test_utils + +Unit test modules should have the same path under neutron/tests/unit/ +as the module they target has under neutron/, and their name should be +the name of the target module prefixed by 'test_'. This requirement +is intended to make it easier for developers to find the unit tests +for a given module. + +Similarly, when a test module targets a package, that module's name +should be the name of the package prefixed by 'test_' with the same +path as when a test targets a module, e.g. :: + + - target package: neutron.ipam + + - test module: neutron.tests.unit.test_ipam + +The following command can be used to validate whether the unit test +tree is structured according to the above requirements: :: + + ./tools/check_unit_test_structure.sh + +Where appropriate, exceptions can be added to the above script. If +code is not part of the neutron namespace, for example, it's probably +reasonable to exclude their unit tests from the check. + Virtual environments ~~~~~~~~~~~~~~~~~~~~ diff --git a/neutron/tests/etc/api-paste.ini.test b/neutron/tests/etc/api-paste.ini.test index 664c3094999..59dd9152f14 100644 --- a/neutron/tests/etc/api-paste.ini.test +++ b/neutron/tests/etc/api-paste.ini.test @@ -5,4 +5,4 @@ pipeline = extensions extensions_test_app paste.filter_factory = neutron.common.extensions:plugin_aware_extension_middleware_factory [app:extensions_test_app] -paste.app_factory = neutron.tests.unit.test_extensions:app_factory +paste.app_factory = neutron.tests.unit.api.test_extensions:app_factory diff --git a/neutron/tests/retargetable/base.py b/neutron/tests/retargetable/base.py index 874dc8d8b36..a149f961c34 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.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin # Each plugin must add a class to plugin_configurations that can configure the diff --git a/neutron/tests/unit/_test_extension_portbindings.py b/neutron/tests/unit/_test_extension_portbindings.py index 39150cde588..1c2dac728e9 100644 --- a/neutron/tests/unit/_test_extension_portbindings.py +++ b/neutron/tests/unit/_test_extension_portbindings.py @@ -22,10 +22,10 @@ from webob import exc from neutron import context from neutron.extensions import portbindings from neutron import manager -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 -class PortBindingsTestCase(test_db_plugin.NeutronDbPluginV2TestCase): +class PortBindingsTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): # VIF_TYPE must be overridden according to plugin vif_type VIF_TYPE = portbindings.VIF_TYPE_OTHER diff --git a/neutron/tests/unit/test_agent_config.py b/neutron/tests/unit/agent/common/test_config.py similarity index 100% rename from neutron/tests/unit/test_agent_config.py rename to neutron/tests/unit/agent/common/test_config.py diff --git a/neutron/tests/unit/brocade/__init__.py b/neutron/tests/unit/agent/dhcp/__init__.py similarity index 100% rename from neutron/tests/unit/brocade/__init__.py rename to neutron/tests/unit/agent/dhcp/__init__.py diff --git a/neutron/tests/unit/test_dhcp_agent.py b/neutron/tests/unit/agent/dhcp/test_agent.py similarity index 100% rename from neutron/tests/unit/test_dhcp_agent.py rename to neutron/tests/unit/agent/dhcp/test_agent.py diff --git a/neutron/tests/unit/test_l3_agent.py b/neutron/tests/unit/agent/l3/test_agent.py similarity index 100% rename from neutron/tests/unit/test_l3_agent.py rename to neutron/tests/unit/agent/l3/test_agent.py diff --git a/neutron/tests/unit/agent/test_dvr_fip_ns.py b/neutron/tests/unit/agent/l3/test_dvr_fip_ns.py similarity index 100% rename from neutron/tests/unit/agent/test_dvr_fip_ns.py rename to neutron/tests/unit/agent/l3/test_dvr_fip_ns.py diff --git a/neutron/tests/unit/test_l3_dvr.py b/neutron/tests/unit/agent/l3/test_link_local_allocator.py similarity index 100% rename from neutron/tests/unit/test_l3_dvr.py rename to neutron/tests/unit/agent/l3/test_link_local_allocator.py diff --git a/neutron/tests/unit/test_router_processing_queue.py b/neutron/tests/unit/agent/l3/test_router_processing_queue.py similarity index 100% rename from neutron/tests/unit/test_router_processing_queue.py rename to neutron/tests/unit/agent/l3/test_router_processing_queue.py diff --git a/neutron/tests/unit/test_linux_daemon.py b/neutron/tests/unit/agent/linux/test_daemon.py similarity index 100% rename from neutron/tests/unit/test_linux_daemon.py rename to neutron/tests/unit/agent/linux/test_daemon.py diff --git a/neutron/tests/unit/test_linux_dhcp.py b/neutron/tests/unit/agent/linux/test_dhcp.py similarity index 100% rename from neutron/tests/unit/test_linux_dhcp.py rename to neutron/tests/unit/agent/linux/test_dhcp.py diff --git a/neutron/tests/unit/test_linux_external_process.py b/neutron/tests/unit/agent/linux/test_external_process.py similarity index 100% rename from neutron/tests/unit/test_linux_external_process.py rename to neutron/tests/unit/agent/linux/test_external_process.py diff --git a/neutron/tests/unit/test_linux_interface.py b/neutron/tests/unit/agent/linux/test_interface.py similarity index 100% rename from neutron/tests/unit/test_linux_interface.py rename to neutron/tests/unit/agent/linux/test_interface.py diff --git a/neutron/tests/unit/test_linux_ip_lib.py b/neutron/tests/unit/agent/linux/test_ip_lib.py similarity index 100% rename from neutron/tests/unit/test_linux_ip_lib.py rename to neutron/tests/unit/agent/linux/test_ip_lib.py diff --git a/neutron/tests/unit/test_iptables_firewall.py b/neutron/tests/unit/agent/linux/test_iptables_firewall.py similarity index 99% rename from neutron/tests/unit/test_iptables_firewall.py rename to neutron/tests/unit/agent/linux/test_iptables_firewall.py index 8a22f827dae..7de64135944 100644 --- a/neutron/tests/unit/test_iptables_firewall.py +++ b/neutron/tests/unit/agent/linux/test_iptables_firewall.py @@ -25,10 +25,10 @@ from neutron.agent.linux import iptables_firewall from neutron.agent import securitygroups_rpc as sg_cfg from neutron.common import constants from neutron.tests import base -from neutron.tests.unit import test_api_v2 +from neutron.tests.unit.api.v2 import test_base -_uuid = test_api_v2._uuid +_uuid = test_base._uuid #TODO(mangelajo): replace all 'IPv4', 'IPv6' to constants FAKE_PREFIX = {'IPv4': '10.0.0.0/24', 'IPv6': 'fe80::/48'} diff --git a/neutron/tests/unit/test_iptables_manager.py b/neutron/tests/unit/agent/linux/test_iptables_manager.py similarity index 100% rename from neutron/tests/unit/test_iptables_manager.py rename to neutron/tests/unit/agent/linux/test_iptables_manager.py diff --git a/neutron/tests/unit/test_metadata_agent.py b/neutron/tests/unit/agent/metadata/test_agent.py similarity index 100% rename from neutron/tests/unit/test_metadata_agent.py rename to neutron/tests/unit/agent/metadata/test_agent.py diff --git a/neutron/tests/unit/test_metadata_namespace_proxy.py b/neutron/tests/unit/agent/metadata/test_namespace_proxy.py similarity index 100% rename from neutron/tests/unit/test_metadata_namespace_proxy.py rename to neutron/tests/unit/agent/metadata/test_namespace_proxy.py diff --git a/neutron/tests/unit/test_agent_rpc.py b/neutron/tests/unit/agent/test_rpc.py similarity index 100% rename from neutron/tests/unit/test_agent_rpc.py rename to neutron/tests/unit/agent/test_rpc.py diff --git a/neutron/tests/unit/test_security_groups_rpc.py b/neutron/tests/unit/agent/test_securitygroups_rpc.py similarity index 99% rename from neutron/tests/unit/test_security_groups_rpc.py rename to neutron/tests/unit/agent/test_securitygroups_rpc.py index d15c883171a..feabbcbfdbd 100644 --- a/neutron/tests/unit/test_security_groups_rpc.py +++ b/neutron/tests/unit/agent/test_securitygroups_rpc.py @@ -36,7 +36,7 @@ from neutron.extensions import allowedaddresspairs as addr_pair from neutron.extensions import securitygroup as ext_sg from neutron import manager from neutron.tests import base -from neutron.tests.unit import test_extension_security_group as test_sg +from neutron.tests.unit.extensions import test_securitygroup as test_sg FAKE_PREFIX = {const.IPv4: '10.0.0.0/24', const.IPv6: '2001:db8::/64'} @@ -46,7 +46,7 @@ FAKE_IP = {const.IPv4: '10.0.0.1', 'IPv6_LLA': 'fe80::123', 'IPv6_DHCP': '2001:db8::3'} -TEST_PLUGIN_CLASS = ('neutron.tests.unit.test_security_groups_rpc.' +TEST_PLUGIN_CLASS = ('neutron.tests.unit.agent.test_securitygroups_rpc.' 'SecurityGroupRpcTestPlugin') diff --git a/neutron/tests/unit/test_dhcp_rpc.py b/neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py similarity index 100% rename from neutron/tests/unit/test_dhcp_rpc.py rename to neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py diff --git a/neutron/tests/unit/test_api_api_common.py b/neutron/tests/unit/api/test_api_common.py similarity index 100% rename from neutron/tests/unit/test_api_api_common.py rename to neutron/tests/unit/api/test_api_common.py diff --git a/neutron/tests/unit/test_extensions.py b/neutron/tests/unit/api/test_extensions.py similarity index 99% rename from neutron/tests/unit/test_extensions.py rename to neutron/tests/unit/api/test_extensions.py index ae533032b03..cbde52239aa 100644 --- a/neutron/tests/unit/test_extensions.py +++ b/neutron/tests/unit/api/test_extensions.py @@ -35,17 +35,17 @@ from neutron.plugins.common import constants from neutron.plugins.ml2 import plugin as ml2_plugin from neutron import quota from neutron.tests import base +from neutron.tests.unit.api.v2 import test_base from neutron.tests.unit import extension_stubs as ext_stubs import neutron.tests.unit.extensions from neutron.tests.unit.extensions import extendedattribute as extattr -from neutron.tests.unit import test_api_v2 from neutron.tests.unit import testlib_api from neutron import wsgi LOG = logging.getLogger(__name__) -_uuid = test_api_v2._uuid -_get_path = test_api_v2._get_path +_uuid = test_base._uuid +_get_path = test_base._get_path extensions_path = ':'.join(neutron.tests.unit.extensions.__path__) @@ -721,7 +721,7 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase): def setUp(self): super(ExtensionExtendedAttributeTestCase, self).setUp() plugin = ( - "neutron.tests.unit.test_extensions." + "neutron.tests.unit.api.test_extensions." "ExtensionExtendedAttributeTestPlugin" ) diff --git a/neutron/tests/unit/cisco/__init__.py b/neutron/tests/unit/api/v2/__init__.py similarity index 100% rename from neutron/tests/unit/cisco/__init__.py rename to neutron/tests/unit/api/v2/__init__.py diff --git a/neutron/tests/unit/test_attributes.py b/neutron/tests/unit/api/v2/test_attributes.py similarity index 100% rename from neutron/tests/unit/test_attributes.py rename to neutron/tests/unit/api/v2/test_attributes.py diff --git a/neutron/tests/unit/test_api_v2.py b/neutron/tests/unit/api/v2/test_base.py similarity index 99% rename from neutron/tests/unit/test_api_v2.py rename to neutron/tests/unit/api/v2/test_base.py index c4b706bd5ab..a12eaec7aa5 100644 --- a/neutron/tests/unit/test_api_v2.py +++ b/neutron/tests/unit/api/v2/test_base.py @@ -1105,7 +1105,7 @@ class SubresourceTest(base.BaseTestCase): def setUp(self): super(SubresourceTest, self).setUp() - plugin = 'neutron.tests.unit.test_api_v2.TestSubresourcePlugin' + plugin = 'neutron.tests.unit.api.v2.test_base.TestSubresourcePlugin' extensions.PluginAwareExtensionManager._instance = None # Save the global RESOURCE_ATTRIBUTE_MAP diff --git a/neutron/tests/unit/test_api_v2_resource.py b/neutron/tests/unit/api/v2/test_resource.py similarity index 100% rename from neutron/tests/unit/test_api_v2_resource.py rename to neutron/tests/unit/api/v2/test_resource.py diff --git a/neutron/tests/unit/cisco/n1kv/__init__.py b/neutron/tests/unit/cmd/__init__.py similarity index 100% rename from neutron/tests/unit/cisco/n1kv/__init__.py rename to neutron/tests/unit/cmd/__init__.py diff --git a/neutron/tests/unit/test_netns_cleanup.py b/neutron/tests/unit/cmd/test_netns_cleanup.py similarity index 100% rename from neutron/tests/unit/test_netns_cleanup.py rename to neutron/tests/unit/cmd/test_netns_cleanup.py diff --git a/neutron/tests/unit/test_ovs_cleanup.py b/neutron/tests/unit/cmd/test_ovs_cleanup.py similarity index 100% rename from neutron/tests/unit/test_ovs_cleanup.py rename to neutron/tests/unit/cmd/test_ovs_cleanup.py diff --git a/neutron/tests/unit/embrane/__init__.py b/neutron/tests/unit/common/__init__.py similarity index 100% rename from neutron/tests/unit/embrane/__init__.py rename to neutron/tests/unit/common/__init__.py diff --git a/neutron/tests/unit/test_config.py b/neutron/tests/unit/common/test_config.py similarity index 100% rename from neutron/tests/unit/test_config.py rename to neutron/tests/unit/common/test_config.py diff --git a/neutron/tests/unit/test_ipv6.py b/neutron/tests/unit/common/test_ipv6_utils.py similarity index 100% rename from neutron/tests/unit/test_ipv6.py rename to neutron/tests/unit/common/test_ipv6_utils.py diff --git a/neutron/tests/unit/test_common_log.py b/neutron/tests/unit/common/test_log.py similarity index 100% rename from neutron/tests/unit/test_common_log.py rename to neutron/tests/unit/common/test_log.py diff --git a/neutron/tests/unit/test_rpc_service.py b/neutron/tests/unit/common/test_rpc.py similarity index 100% rename from neutron/tests/unit/test_rpc_service.py rename to neutron/tests/unit/common/test_rpc.py diff --git a/neutron/tests/unit/test_common_utils.py b/neutron/tests/unit/common/test_utils.py similarity index 100% rename from neutron/tests/unit/test_common_utils.py rename to neutron/tests/unit/common/test_utils.py diff --git a/neutron/tests/unit/db/metering/test_db_metering.py b/neutron/tests/unit/db/metering/test_metering_db.py similarity index 98% rename from neutron/tests/unit/db/metering/test_db_metering.py rename to neutron/tests/unit/db/metering/test_metering_db.py index 56c36d802d6..bd513696b33 100644 --- a/neutron/tests/unit/db/metering/test_db_metering.py +++ b/neutron/tests/unit/db/metering/test_metering_db.py @@ -24,7 +24,7 @@ import neutron.extensions from neutron.extensions import metering from neutron.plugins.common import constants from neutron.services.metering import metering_plugin -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 DB_METERING_PLUGIN_KLASS = ( "neutron.services.metering." @@ -108,8 +108,9 @@ class MeteringPluginDbTestCaseMixin(object): yield metering_label_rule -class MeteringPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase, - MeteringPluginDbTestCaseMixin): +class MeteringPluginDbTestCase( + test_db_base_plugin_v2.NeutronDbPluginV2TestCase, + MeteringPluginDbTestCaseMixin): fmt = 'json' resource_prefix_map = dict( diff --git a/neutron/tests/unit/db/test_agent_db.py b/neutron/tests/unit/db/test_agents_db.py similarity index 100% rename from neutron/tests/unit/db/test_agent_db.py rename to neutron/tests/unit/db/test_agents_db.py diff --git a/neutron/tests/unit/test_extension_allowedaddresspairs.py b/neutron/tests/unit/db/test_allowedaddresspairs_db.py similarity index 98% rename from neutron/tests/unit/test_extension_allowedaddresspairs.py rename to neutron/tests/unit/db/test_allowedaddresspairs_db.py index 4f740b64474..6185d2e1880 100644 --- a/neutron/tests/unit/test_extension_allowedaddresspairs.py +++ b/neutron/tests/unit/db/test_allowedaddresspairs_db.py @@ -22,15 +22,16 @@ from neutron.extensions import allowedaddresspairs as addr_pair from neutron.extensions import portsecurity as psec from neutron.extensions import securitygroup as secgroup from neutron import manager -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 from oslo_config import cfg -DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_allowedaddresspairs.' +DB_PLUGIN_KLASS = ('neutron.tests.unit.db.test_allowedaddresspairs_db.' 'AllowedAddressPairTestPlugin') -class AllowedAddressPairTestCase(test_db_plugin.NeutronDbPluginV2TestCase): +class AllowedAddressPairTestCase( + test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def setUp(self, plugin=None, ext_mgr=None): super(AllowedAddressPairTestCase, self).setUp(plugin) diff --git a/neutron/tests/unit/test_db_plugin.py b/neutron/tests/unit/db/test_db_base_plugin_v2.py similarity index 99% rename from neutron/tests/unit/test_db_plugin.py rename to neutron/tests/unit/db/test_db_base_plugin_v2.py index 8a5393b4939..5db1570ef7c 100644 --- a/neutron/tests/unit/test_db_plugin.py +++ b/neutron/tests/unit/db/test_db_base_plugin_v2.py @@ -39,7 +39,7 @@ from neutron.db import db_base_plugin_v2 from neutron.db import models_v2 from neutron import manager from neutron.tests import base -from neutron.tests.unit import test_extensions +from neutron.tests.unit.api import test_extensions from neutron.tests.unit import testlib_api DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2' diff --git a/neutron/tests/unit/db/test_l3_ha_db.py b/neutron/tests/unit/db/test_l3_hamode_db.py similarity index 100% rename from neutron/tests/unit/db/test_l3_ha_db.py rename to neutron/tests/unit/db/test_l3_hamode_db.py diff --git a/neutron/tests/unit/test_db_migration.py b/neutron/tests/unit/db/test_migration.py similarity index 100% rename from neutron/tests/unit/test_db_migration.py rename to neutron/tests/unit/db/test_migration.py diff --git a/neutron/tests/unit/hyperv/__init__.py b/neutron/tests/unit/debug/__init__.py similarity index 100% rename from neutron/tests/unit/hyperv/__init__.py rename to neutron/tests/unit/debug/__init__.py diff --git a/neutron/tests/unit/test_debug_commands.py b/neutron/tests/unit/debug/test_commands.py similarity index 100% rename from neutron/tests/unit/test_debug_commands.py rename to neutron/tests/unit/debug/test_commands.py diff --git a/neutron/tests/unit/test_api_v2_extension.py b/neutron/tests/unit/extensions/base.py similarity index 96% rename from neutron/tests/unit/test_api_v2_extension.py rename to neutron/tests/unit/extensions/base.py index 8ead1f919e8..2fa03024e86 100644 --- a/neutron/tests/unit/test_api_v2_extension.py +++ b/neutron/tests/unit/extensions/base.py @@ -26,8 +26,8 @@ import webtest from neutron.api import extensions from neutron.api.v2 import attributes from neutron import quota -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_extensions +from neutron.tests.unit.api import test_extensions +from neutron.tests.unit.api.v2 import test_base from neutron.tests.unit import testlib_api @@ -117,7 +117,7 @@ class ExtensionTestCase(testlib_api.WebTestCase): if self._translate_resource_name: path = path.replace('_', '-') res = self.api.delete( - test_api_v2._get_path(path, id=entity_id, fmt=self.fmt)) + test_base._get_path(path, id=entity_id, fmt=self.fmt)) delete_entity = getattr(self.plugin.return_value, "delete_" + entity) delete_entity.assert_called_with(mock.ANY, entity_id) self.assertEqual(res.status_int, exc.HTTPNoContent.code) diff --git a/neutron/tests/unit/test_agent_ext_plugin.py b/neutron/tests/unit/extensions/test_agent.py similarity index 97% rename from neutron/tests/unit/test_agent_ext_plugin.py rename to neutron/tests/unit/extensions/test_agent.py index af925208b4c..f3bcb5c3455 100644 --- a/neutron/tests/unit/test_agent_ext_plugin.py +++ b/neutron/tests/unit/extensions/test_agent.py @@ -29,14 +29,14 @@ from neutron.db import agents_db from neutron.db import db_base_plugin_v2 from neutron.extensions import agent from neutron.openstack.common import uuidutils -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.api.v2 import test_base +from neutron.tests.unit.db import test_db_base_plugin_v2 LOG = logging.getLogger(__name__) _uuid = uuidutils.generate_uuid -_get_path = test_api_v2._get_path +_get_path = test_base._get_path L3_HOSTA = 'hosta' DHCP_HOSTA = 'hosta' L3_HOSTB = 'hostb' @@ -180,11 +180,11 @@ class AgentDBTestMixIn(object): class AgentDBTestCase(AgentDBTestMixIn, - test_db_plugin.NeutronDbPluginV2TestCase): + test_db_base_plugin_v2.NeutronDbPluginV2TestCase): fmt = 'json' def setUp(self): - plugin = 'neutron.tests.unit.test_agent_ext_plugin.TestAgentPlugin' + plugin = 'neutron.tests.unit.extensions.test_agent.TestAgentPlugin' # for these tests we need to enable overlapping ips cfg.CONF.set_default('allow_overlapping_ips', True) # Save the original RESOURCE_ATTRIBUTE_MAP diff --git a/neutron/tests/unit/test_extension_ext_net.py b/neutron/tests/unit/extensions/test_external_net.py similarity index 96% rename from neutron/tests/unit/test_extension_ext_net.py rename to neutron/tests/unit/extensions/test_external_net.py index 6cb0f1fb9d4..b2ccce818e3 100644 --- a/neutron/tests/unit/test_extension_ext_net.py +++ b/neutron/tests/unit/extensions/test_external_net.py @@ -26,14 +26,14 @@ from neutron.db import models_v2 from neutron.extensions import external_net as external_net from neutron import manager from neutron.openstack.common import uuidutils -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.api.v2 import test_base +from neutron.tests.unit.db import test_db_base_plugin_v2 LOG = logging.getLogger(__name__) _uuid = uuidutils.generate_uuid -_get_path = test_api_v2._get_path +_get_path = test_base._get_path class ExtNetTestExtensionManager(object): @@ -48,7 +48,7 @@ class ExtNetTestExtensionManager(object): return [] -class ExtNetDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase): +class ExtNetDBTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def _create_network(self, fmt, name, admin_state_up, **kwargs): """Override the routine for allowing the router:external attribute.""" @@ -62,7 +62,7 @@ class ExtNetDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase): fmt, name, admin_state_up, arg_list=arg_list, **new_args) def setUp(self): - plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin' + plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin' ext_mgr = ExtNetTestExtensionManager() super(ExtNetDBTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr) diff --git a/neutron/tests/unit/test_extension_extradhcpopts.py b/neutron/tests/unit/extensions/test_extra_dhcp_opt.py similarity index 98% rename from neutron/tests/unit/test_extension_extradhcpopts.py rename to neutron/tests/unit/extensions/test_extra_dhcp_opt.py index 03fe2a377f0..68ecd748d95 100644 --- a/neutron/tests/unit/test_extension_extradhcpopts.py +++ b/neutron/tests/unit/extensions/test_extra_dhcp_opt.py @@ -21,12 +21,12 @@ import webob.exc from neutron.db import db_base_plugin_v2 from neutron.db import extradhcpopt_db as edo_db from neutron.extensions import extra_dhcp_opt as edo_ext -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 LOG = logging.getLogger(__name__) DB_PLUGIN_KLASS = ( - 'neutron.tests.unit.test_extension_extradhcpopts.ExtraDhcpOptTestPlugin') + 'neutron.tests.unit.extensions.test_extra_dhcp_opt.ExtraDhcpOptTestPlugin') class ExtraDhcpOptTestPlugin(db_base_plugin_v2.NeutronDbPluginV2, @@ -53,7 +53,7 @@ class ExtraDhcpOptTestPlugin(db_base_plugin_v2.NeutronDbPluginV2, return rtn_port -class ExtraDhcpOptDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase): +class ExtraDhcpOptDBTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def setUp(self, plugin=DB_PLUGIN_KLASS): super(ExtraDhcpOptDBTestCase, self).setUp(plugin=plugin) diff --git a/neutron/tests/unit/test_extension_extraroute.py b/neutron/tests/unit/extensions/test_extraroute.py similarity index 98% rename from neutron/tests/unit/test_extension_extraroute.py rename to neutron/tests/unit/extensions/test_extraroute.py index ece89c0662f..78e555f0b54 100644 --- a/neutron/tests/unit/test_extension_extraroute.py +++ b/neutron/tests/unit/extensions/test_extraroute.py @@ -24,14 +24,14 @@ from neutron.db import extraroute_db from neutron.extensions import extraroute from neutron.extensions import l3 from neutron.openstack.common import uuidutils -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_l3_plugin as test_l3 +from neutron.tests.unit.api.v2 import test_base +from neutron.tests.unit.extensions import test_l3 as test_l3 LOG = logging.getLogger(__name__) _uuid = uuidutils.generate_uuid -_get_path = test_api_v2._get_path +_get_path = test_base._get_path class ExtraRouteTestExtensionManager(object): @@ -459,7 +459,7 @@ class ExtraRouteDBIntTestCase(test_l3.L3NatDBIntTestCase, def setUp(self, plugin=None, ext_mgr=None): if not plugin: - plugin = ('neutron.tests.unit.test_extension_extraroute.' + plugin = ('neutron.tests.unit.extensions.test_extraroute.' 'TestExtraRouteIntPlugin') # for these tests we need to enable overlapping ips cfg.CONF.set_default('allow_overlapping_ips', True) @@ -474,9 +474,9 @@ class ExtraRouteDBSepTestCase(test_l3.L3NatDBSepTestCase, ExtraRouteDBTestCaseBase): def setUp(self): # the plugin without L3 support - plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin' + plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin' # the L3 service plugin - l3_plugin = ('neutron.tests.unit.test_extension_extraroute.' + l3_plugin = ('neutron.tests.unit.extensions.test_extraroute.' 'TestExtraRouteL3NatServicePlugin') service_plugins = {'l3_plugin_name': l3_plugin} diff --git a/neutron/tests/unit/test_l3_plugin.py b/neutron/tests/unit/extensions/test_l3.py similarity index 99% rename from neutron/tests/unit/test_l3_plugin.py rename to neutron/tests/unit/extensions/test_l3.py index cdc883055da..8c824d6c078 100644 --- a/neutron/tests/unit/test_l3_plugin.py +++ b/neutron/tests/unit/extensions/test_l3.py @@ -47,15 +47,15 @@ from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants from neutron.tests import base from neutron.tests import fake_notifier -from neutron.tests.unit import test_agent_ext_plugin -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_api_v2_extension -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.api.v2 import test_base +from neutron.tests.unit.db import test_db_base_plugin_v2 +from neutron.tests.unit.extensions import base as test_extensions_base +from neutron.tests.unit.extensions import test_agent LOG = logging.getLogger(__name__) _uuid = uuidutils.generate_uuid -_get_path = test_api_v2._get_path +_get_path = test_base._get_path class L3TestExtensionManager(object): @@ -76,7 +76,7 @@ class L3TestExtensionManager(object): return [] -class L3NatExtensionTestCase(test_api_v2_extension.ExtensionTestCase): +class L3NatExtensionTestCase(test_extensions_base.ExtensionTestCase): fmt = 'json' def setUp(self): @@ -464,7 +464,7 @@ class L3NatTestCaseMixin(object): private_port = None if port_id: private_port = self._show('ports', port_id) - with test_db_plugin.optional_ctx(private_port, + with test_db_base_plugin_v2.optional_ctx(private_port, self.port) as private_port: with self.router() as r: sid = private_port['port']['fixed_ips'][0]['subnet_id'] @@ -2431,13 +2431,13 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin): self._test_notify_op_agent(self._test_floatingips_op_agent) -class L3BaseForIntTests(test_db_plugin.NeutronDbPluginV2TestCase): +class L3BaseForIntTests(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): mock_rescheduling = True def setUp(self, plugin=None, ext_mgr=None, service_plugins=None): if not plugin: - plugin = 'neutron.tests.unit.test_l3_plugin.TestL3NatIntPlugin' + plugin = 'neutron.tests.unit.extensions.test_l3.TestL3NatIntPlugin' # for these tests we need to enable overlapping ips cfg.CONF.set_default('allow_overlapping_ips', True) ext_mgr = ext_mgr or L3TestExtensionManager() @@ -2452,14 +2452,14 @@ class L3BaseForIntTests(test_db_plugin.NeutronDbPluginV2TestCase): self.setup_notification_driver() -class L3BaseForSepTests(test_db_plugin.NeutronDbPluginV2TestCase): +class L3BaseForSepTests(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def setUp(self, plugin=None, ext_mgr=None): # the plugin without L3 support if not plugin: - plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin' + plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin' # the L3 service plugin - l3_plugin = ('neutron.tests.unit.test_l3_plugin.' + l3_plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatServicePlugin') service_plugins = {'l3_plugin_name': l3_plugin} @@ -2475,12 +2475,12 @@ class L3BaseForSepTests(test_db_plugin.NeutronDbPluginV2TestCase): class L3NatDBIntAgentSchedulingTestCase(L3BaseForIntTests, L3NatTestCaseMixin, - test_agent_ext_plugin. + test_agent. AgentDBTestMixIn): """Unit tests for core plugin with L3 routing and scheduling integrated.""" - def setUp(self, plugin='neutron.tests.unit.test_l3_plugin.' + def setUp(self, plugin='neutron.tests.unit.extensions.test_l3.' 'TestL3NatIntAgentSchedulingPlugin', ext_mgr=None, service_plugins=None): self.mock_rescheduling = False diff --git a/neutron/tests/unit/test_extension_ext_gw_mode.py b/neutron/tests/unit/extensions/test_l3_ext_gw_mode.py similarity index 96% rename from neutron/tests/unit/test_extension_ext_gw_mode.py rename to neutron/tests/unit/extensions/test_l3_ext_gw_mode.py index 8ca7a2bee31..291c88fcb66 100644 --- a/neutron/tests/unit/test_extension_ext_gw_mode.py +++ b/neutron/tests/unit/extensions/test_l3_ext_gw_mode.py @@ -27,8 +27,8 @@ from neutron.db import models_v2 from neutron.extensions import l3 from neutron.extensions import l3_ext_gw_mode from neutron.openstack.common import uuidutils -from neutron.tests.unit import test_db_plugin -from neutron.tests.unit import test_l3_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 +from neutron.tests.unit.extensions import test_l3 from neutron.tests.unit import testlib_api _uuid = uuidutils.generate_uuid @@ -60,7 +60,7 @@ class TestExtensionManager(object): # A simple class for making a concrete class out of the mixin # for the case of a plugin that integrates l3 routing. -class TestDbIntPlugin(test_l3_plugin.TestL3NatIntPlugin, +class TestDbIntPlugin(test_l3.TestL3NatIntPlugin, l3_gwmode_db.L3_NAT_db_mixin): supported_extension_aliases = ["external-net", "router", "ext-gw-mode"] @@ -68,7 +68,7 @@ class TestDbIntPlugin(test_l3_plugin.TestL3NatIntPlugin, # A simple class for making a concrete class out of the mixin # for the case of a l3 router service plugin -class TestDbSepPlugin(test_l3_plugin.TestL3NatServicePlugin, +class TestDbSepPlugin(test_l3.TestL3NatServicePlugin, l3_gwmode_db.L3_NAT_db_mixin): supported_extension_aliases = ["router", "ext-gw-mode"] @@ -299,8 +299,8 @@ class TestL3GwModeMixin(testlib_api.SqlTestCase): self.assertIsNone(router.get('enable_snat')) -class ExtGwModeIntTestCase(test_db_plugin.NeutronDbPluginV2TestCase, - test_l3_plugin.L3NatTestCaseMixin): +class ExtGwModeIntTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase, + test_l3.L3NatTestCaseMixin): def setUp(self, plugin=None, svc_plugins=None, ext_mgr=None): # Store l3 resource attribute map as it will be updated @@ -309,7 +309,8 @@ class ExtGwModeIntTestCase(test_db_plugin.NeutronDbPluginV2TestCase, self._l3_attribute_map_bk[item] = ( l3.RESOURCE_ATTRIBUTE_MAP[item].copy()) plugin = plugin or ( - 'neutron.tests.unit.test_extension_ext_gw_mode.TestDbIntPlugin') + 'neutron.tests.unit.extensions.test_l3_ext_gw_mode.' + 'TestDbIntPlugin') # for these tests we need to enable overlapping ips cfg.CONF.set_default('allow_overlapping_ips', True) ext_mgr = ext_mgr or TestExtensionManager() @@ -430,9 +431,9 @@ class ExtGwModeSepTestCase(ExtGwModeIntTestCase): self._l3_attribute_map_bk[item] = ( l3.RESOURCE_ATTRIBUTE_MAP[item].copy()) plugin = plugin or ( - 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin') + 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin') # the L3 service plugin - l3_plugin = ('neutron.tests.unit.test_extension_ext_gw_mode.' + l3_plugin = ('neutron.tests.unit.extensions.test_l3_ext_gw_mode.' 'TestDbSepPlugin') svc_plugins = {'l3_plugin_name': l3_plugin} # for these tests we need to enable overlapping ips diff --git a/neutron/tests/unit/test_extension_netmtu.py b/neutron/tests/unit/extensions/test_netmtu.py similarity index 93% rename from neutron/tests/unit/test_extension_netmtu.py rename to neutron/tests/unit/extensions/test_netmtu.py index ca57d7a052f..957adaef39e 100644 --- a/neutron/tests/unit/test_extension_netmtu.py +++ b/neutron/tests/unit/extensions/test_netmtu.py @@ -16,7 +16,7 @@ from neutron.common import constants from neutron.db import db_base_plugin_v2 from neutron.db import netmtu_db from neutron.extensions import netmtu -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 class NetmtuExtensionManager(object): @@ -42,12 +42,12 @@ class NetmtuExtensionTestPlugin(db_base_plugin_v2.NeutronDbPluginV2, supported_extension_aliases = ["net-mtu"] -class NetmtuExtensionTestCase(test_db_plugin.TestNetworksV2): +class NetmtuExtensionTestCase(test_db_base_plugin_v2.TestNetworksV2): """Test API extension net-mtu attributes. """ def setUp(self): - plugin = ('neutron.tests.unit.test_extension_netmtu.' + + plugin = ('neutron.tests.unit.extensions.test_netmtu.' + 'NetmtuExtensionTestPlugin') ext_mgr = NetmtuExtensionManager() super(NetmtuExtensionTestCase, self).setUp(plugin=plugin, diff --git a/neutron/tests/unit/test_extension_portsecurity.py b/neutron/tests/unit/extensions/test_portsecurity.py similarity index 98% rename from neutron/tests/unit/test_extension_portsecurity.py rename to neutron/tests/unit/extensions/test_portsecurity.py index a7664058e7b..42d0c340cca 100644 --- a/neutron/tests/unit/test_extension_portsecurity.py +++ b/neutron/tests/unit/extensions/test_portsecurity.py @@ -23,20 +23,20 @@ from neutron.db import securitygroups_db from neutron.extensions import portsecurity as psec from neutron.extensions import securitygroup as ext_sg from neutron import manager -from neutron.tests.unit import test_db_plugin -from neutron.tests.unit import test_extension_security_group +from neutron.tests.unit.db import test_db_base_plugin_v2 +from neutron.tests.unit.extensions import test_securitygroup -DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_portsecurity.' +DB_PLUGIN_KLASS = ('neutron.tests.unit.extensions.test_portsecurity.' 'PortSecurityTestPlugin') class PortSecurityTestCase( - test_extension_security_group.SecurityGroupsTestCase, - test_db_plugin.NeutronDbPluginV2TestCase): + test_securitygroup.SecurityGroupsTestCase, + test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def setUp(self, plugin=None): ext_mgr = ( - test_extension_security_group.SecurityGroupTestExtensionManager()) + test_securitygroup.SecurityGroupTestExtensionManager()) super(PortSecurityTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr) # Check if a plugin supports security groups diff --git a/neutron/tests/unit/test_extension_pnet.py b/neutron/tests/unit/extensions/test_providernet.py similarity index 94% rename from neutron/tests/unit/test_extension_pnet.py rename to neutron/tests/unit/extensions/test_providernet.py index 293d50f0a5f..b55eb44d95d 100644 --- a/neutron/tests/unit/test_extension_pnet.py +++ b/neutron/tests/unit/extensions/test_providernet.py @@ -26,8 +26,8 @@ from neutron.extensions import providernet as pnet from neutron import manager from neutron.openstack.common import uuidutils from neutron import quota -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_extensions +from neutron.tests.unit.api import test_extensions +from neutron.tests.unit.api.v2 import test_base from neutron.tests.unit import testlib_api @@ -101,9 +101,9 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase): instance.get_network.return_value = {'tenant_id': ctx.tenant_id, 'shared': False} net_id = uuidutils.generate_uuid() - res = self.api.put(test_api_v2._get_path('networks', - id=net_id, - fmt=self.fmt), + res = self.api.put(test_base._get_path('networks', + id=net_id, + fmt=self.fmt), self.serialize({'network': data}), extra_environ=env, expect_errors=expect_errors) @@ -112,7 +112,7 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase): def _post_network_with_provider_attrs(self, ctx, expect_errors=False): data = self._prepare_net_data() env = {'neutron.context': ctx} - res = self.api.post(test_api_v2._get_path('networks', fmt=self.fmt), + res = self.api.post(test_base._get_path('networks', fmt=self.fmt), self.serialize({'network': data}), content_type='application/' + self.fmt, extra_environ=env, @@ -124,7 +124,7 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase): data = self._prepare_net_data() data.update(bad_data) env = {'neutron.context': ctx} - res = self.api.post(test_api_v2._get_path('networks', fmt=self.fmt), + res = self.api.post(test_base._get_path('networks', fmt=self.fmt), self.serialize({'network': data}), content_type='application/' + self.fmt, extra_environ=env, diff --git a/neutron/tests/unit/test_quota_ext.py b/neutron/tests/unit/extensions/test_quotasv2.py similarity index 99% rename from neutron/tests/unit/test_quota_ext.py rename to neutron/tests/unit/extensions/test_quotasv2.py index 257445bd717..349706b5580 100644 --- a/neutron/tests/unit/test_quota_ext.py +++ b/neutron/tests/unit/extensions/test_quotasv2.py @@ -30,12 +30,12 @@ from neutron import context from neutron.db import quota_db from neutron import quota from neutron.tests import base -from neutron.tests.unit import test_api_v2 +from neutron.tests.unit.api.v2 import test_base from neutron.tests.unit import testlib_api TARGET_PLUGIN = 'neutron.plugins.ml2.plugin.Ml2Plugin' -_get_path = test_api_v2._get_path +_get_path = test_base._get_path class QuotaExtensionTestCase(testlib_api.WebTestCase): diff --git a/neutron/tests/unit/test_extension_security_group.py b/neutron/tests/unit/extensions/test_securitygroup.py similarity index 99% rename from neutron/tests/unit/test_extension_security_group.py rename to neutron/tests/unit/extensions/test_securitygroup.py index 2a401bcc9eb..4f9533a5f35 100644 --- a/neutron/tests/unit/test_extension_security_group.py +++ b/neutron/tests/unit/extensions/test_securitygroup.py @@ -29,9 +29,9 @@ from neutron.db import securitygroups_db from neutron.extensions import securitygroup as ext_sg from neutron import manager from neutron.tests import base -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 -DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_security_group.' +DB_PLUGIN_KLASS = ('neutron.tests.unit.extensions.test_securitygroup.' 'SecurityGroupTestPlugin') @@ -53,7 +53,7 @@ class SecurityGroupTestExtensionManager(object): return [] -class SecurityGroupsTestCase(test_db_plugin.NeutronDbPluginV2TestCase): +class SecurityGroupsTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def _create_security_group(self, fmt, name, description, **kwargs): diff --git a/neutron/tests/unit/test_servicetype.py b/neutron/tests/unit/extensions/test_servicetype.py similarity index 96% rename from neutron/tests/unit/test_servicetype.py rename to neutron/tests/unit/extensions/test_servicetype.py index 6ca841aa306..cc834ffe5b4 100644 --- a/neutron/tests/unit/test_servicetype.py +++ b/neutron/tests/unit/extensions/test_servicetype.py @@ -25,18 +25,18 @@ from neutron.db import servicetype_db as st_db from neutron.extensions import servicetype from neutron.plugins.common import constants from neutron.services import provider_configuration as provconf +from neutron.tests.unit.api import test_extensions +from neutron.tests.unit.api.v2 import test_base +from neutron.tests.unit.db import test_db_base_plugin_v2 from neutron.tests.unit import dummy_plugin as dp -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_db_plugin -from neutron.tests.unit import test_extensions from neutron.tests.unit import testlib_api DEFAULT_SERVICE_DEFS = [{'service_class': constants.DUMMY, 'plugin': dp.DUMMY_PLUGIN_NAME}] -_uuid = test_api_v2._uuid -_get_path = test_api_v2._get_path +_uuid = test_base._uuid +_get_path = test_base._get_path class ServiceTypeManagerTestCase(testlib_api.SqlTestCase): @@ -165,7 +165,7 @@ class ServiceTypeExtensionTestCaseBase(testlib_api.WebTestCase): def setUp(self): # This is needed because otherwise a failure will occur due to # nonexisting core_plugin - self.setup_coreplugin(test_db_plugin.DB_PLUGIN_KLASS) + self.setup_coreplugin(test_db_base_plugin_v2.DB_PLUGIN_KLASS) cfg.CONF.set_override('service_plugins', ["%s.%s" % (dp.__name__, diff --git a/neutron/tests/unit/ipam/test_subnet_alloc.py b/neutron/tests/unit/ipam/test_subnet_alloc.py index a0fc85d82b4..592fca00477 100644 --- a/neutron/tests/unit/ipam/test_subnet_alloc.py +++ b/neutron/tests/unit/ipam/test_subnet_alloc.py @@ -24,7 +24,7 @@ import neutron.ipam as ipam from neutron.ipam import subnet_alloc from neutron import manager from neutron.openstack.common import uuidutils -from neutron.tests.unit import test_db_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 from neutron.tests.unit import testlib_api @@ -33,7 +33,7 @@ class TestSubnetAllocation(testlib_api.SqlTestCase): def setUp(self): super(TestSubnetAllocation, self).setUp() self._tenant_id = 'test-tenant' - self.setup_coreplugin(test_db_plugin.DB_PLUGIN_KLASS) + self.setup_coreplugin(test_db_base_plugin_v2.DB_PLUGIN_KLASS) self.plugin = manager.NeutronManager.get_plugin() self.ctx = context.get_admin_context() cfg.CONF.set_override('allow_overlapping_ips', True) diff --git a/neutron/tests/unit/notifiers/test_notifiers_nova.py b/neutron/tests/unit/notifiers/test_nova.py similarity index 100% rename from neutron/tests/unit/notifiers/test_notifiers_nova.py rename to neutron/tests/unit/notifiers/test_nova.py diff --git a/neutron/tests/unit/ibm/__init__.py b/neutron/tests/unit/plugins/__init__.py similarity index 100% rename from neutron/tests/unit/ibm/__init__.py rename to neutron/tests/unit/plugins/__init__.py diff --git a/neutron/tests/unit/ipam/__init__.py b/neutron/tests/unit/plugins/brocade/__init__.py similarity index 100% rename from neutron/tests/unit/ipam/__init__.py rename to neutron/tests/unit/plugins/brocade/__init__.py diff --git a/neutron/tests/unit/brocade/test_brocade_db.py b/neutron/tests/unit/plugins/brocade/test_brocade_db.py similarity index 98% rename from neutron/tests/unit/brocade/test_brocade_db.py rename to neutron/tests/unit/plugins/brocade/test_brocade_db.py index 1733dc4c15c..99d5b3fb9b0 100644 --- a/neutron/tests/unit/brocade/test_brocade_db.py +++ b/neutron/tests/unit/plugins/brocade/test_brocade_db.py @@ -21,7 +21,7 @@ import uuid from neutron import context from neutron.plugins.brocade.db import models as brocade_db -from neutron.tests.unit import test_db_plugin as test_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin TEST_VLAN = 1000 diff --git a/neutron/tests/unit/brocade/test_brocade_plugin.py b/neutron/tests/unit/plugins/brocade/test_brocade_plugin.py similarity index 97% rename from neutron/tests/unit/brocade/test_brocade_plugin.py rename to neutron/tests/unit/plugins/brocade/test_brocade_plugin.py index ea2f0f83d43..bccff29b747 100644 --- a/neutron/tests/unit/brocade/test_brocade_plugin.py +++ b/neutron/tests/unit/plugins/brocade/test_brocade_plugin.py @@ -20,7 +20,7 @@ from oslo_utils import importutils from neutron.extensions import portbindings from neutron.plugins.brocade import NeutronPlugin as brocade_plugin from neutron.tests.unit import _test_extension_portbindings as test_bindings -from neutron.tests.unit import test_db_plugin as test_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin PLUGIN_NAME = ('neutron.plugins.brocade.' diff --git a/neutron/tests/unit/brocade/test_brocade_vlan.py b/neutron/tests/unit/plugins/brocade/test_brocade_vlan.py similarity index 100% rename from neutron/tests/unit/brocade/test_brocade_vlan.py rename to neutron/tests/unit/plugins/brocade/test_brocade_vlan.py diff --git a/neutron/tests/unit/linuxbridge/__init__.py b/neutron/tests/unit/plugins/cisco/__init__.py similarity index 100% rename from neutron/tests/unit/linuxbridge/__init__.py rename to neutron/tests/unit/plugins/cisco/__init__.py diff --git a/neutron/tests/unit/ml2/__init__.py b/neutron/tests/unit/plugins/cisco/n1kv/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/__init__.py rename to neutron/tests/unit/plugins/cisco/n1kv/__init__.py diff --git a/neutron/tests/unit/cisco/n1kv/fake_client.py b/neutron/tests/unit/plugins/cisco/n1kv/fake_client.py similarity index 100% rename from neutron/tests/unit/cisco/n1kv/fake_client.py rename to neutron/tests/unit/plugins/cisco/n1kv/fake_client.py diff --git a/neutron/tests/unit/cisco/n1kv/test_n1kv_db.py b/neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_db.py similarity index 99% rename from neutron/tests/unit/cisco/n1kv/test_n1kv_db.py rename to neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_db.py index 434250e2a9d..eadc4b4a3d0 100644 --- a/neutron/tests/unit/cisco/n1kv/test_n1kv_db.py +++ b/neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_db.py @@ -24,7 +24,7 @@ from neutron.plugins.cisco.common import cisco_constants as c_const from neutron.plugins.cisco.common import cisco_exceptions as c_exc from neutron.plugins.cisco.db import n1kv_db_v2 from neutron.plugins.cisco.db import n1kv_models_v2 -from neutron.tests.unit import test_db_plugin as test_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin from neutron.tests.unit import testlib_api diff --git a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py b/neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_plugin.py similarity index 99% rename from neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py rename to neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_plugin.py index 224883a983d..b388e083fc9 100644 --- a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py +++ b/neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_plugin.py @@ -34,11 +34,11 @@ from neutron.plugins.cisco.extensions import policy_profile from neutron.plugins.cisco.n1kv import n1kv_client from neutron.plugins.cisco.n1kv import n1kv_neutron_plugin from neutron.tests.unit import _test_extension_portbindings as test_bindings -from neutron.tests.unit.cisco.n1kv import fake_client -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_db_plugin as test_plugin -from neutron.tests.unit import test_l3_plugin -from neutron.tests.unit import test_l3_schedulers +from neutron.tests.unit.api.v2 import test_base +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin +from neutron.tests.unit.extensions import test_l3 +from neutron.tests.unit.plugins.cisco.n1kv import fake_client +from neutron.tests.unit.scheduler import test_l3_agent_scheduler PHYS_NET = 'some-phys-net' @@ -128,7 +128,7 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase): create. Default argument value chosen to correspond to the default name specified in config.py file. """ - uuid = test_api_v2._uuid() + uuid = test_base._uuid() profile = {'id': uuid, 'name': name} return n1kv_db_v2.create_policy_profile(profile) @@ -1281,11 +1281,11 @@ class TestN1kvSubnets(test_plugin.TestSubnetsV2, self.assertEqual(1, mock_method.call_count) -class TestN1kvL3Test(test_l3_plugin.L3NatExtensionTestCase): +class TestN1kvL3Test(test_l3.L3NatExtensionTestCase): pass -class TestN1kvL3SchedulersTest(test_l3_schedulers.L3SchedulerTestCase): +class TestN1kvL3SchedulersTest(test_l3_agent_scheduler.L3SchedulerTestCase): pass diff --git a/neutron/tests/unit/cisco/test_network_db.py b/neutron/tests/unit/plugins/cisco/test_network_db.py similarity index 100% rename from neutron/tests/unit/cisco/test_network_db.py rename to neutron/tests/unit/plugins/cisco/test_network_db.py diff --git a/neutron/tests/unit/ml2/db/__init__.py b/neutron/tests/unit/plugins/embrane/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/db/__init__.py rename to neutron/tests/unit/plugins/embrane/__init__.py diff --git a/neutron/tests/unit/embrane/test_embrane_l3_plugin.py b/neutron/tests/unit/plugins/embrane/test_embrane_l3_plugin.py similarity index 93% rename from neutron/tests/unit/embrane/test_embrane_l3_plugin.py rename to neutron/tests/unit/plugins/embrane/test_embrane_l3_plugin.py index 83495afac2f..b578d1c956d 100644 --- a/neutron/tests/unit/embrane/test_embrane_l3_plugin.py +++ b/neutron/tests/unit/plugins/embrane/test_embrane_l3_plugin.py @@ -16,7 +16,7 @@ from oslo_config import cfg from neutron.plugins.embrane.common import config # noqa -from neutron.tests.unit import test_extension_extraroute as extraroute_test +from neutron.tests.unit.extensions import test_extraroute as extraroute_test PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.' 'EmbraneFakePlugin') diff --git a/neutron/tests/unit/embrane/test_embrane_neutron_plugin.py b/neutron/tests/unit/plugins/embrane/test_embrane_neutron_plugin.py similarity index 97% rename from neutron/tests/unit/embrane/test_embrane_neutron_plugin.py rename to neutron/tests/unit/plugins/embrane/test_embrane_neutron_plugin.py index cf68c5fd75d..8ac9d341f3d 100644 --- a/neutron/tests/unit/embrane/test_embrane_neutron_plugin.py +++ b/neutron/tests/unit/plugins/embrane/test_embrane_neutron_plugin.py @@ -18,7 +18,7 @@ import mock from oslo_config import cfg from neutron.plugins.embrane.common import config # noqa -from neutron.tests.unit import test_db_plugin as test_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.' 'EmbraneFakePlugin') diff --git a/neutron/tests/unit/ml2/drivers/__init__.py b/neutron/tests/unit/plugins/hyperv/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/__init__.py rename to neutron/tests/unit/plugins/hyperv/__init__.py diff --git a/neutron/tests/unit/ml2/drivers/arista/__init__.py b/neutron/tests/unit/plugins/ibm/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/arista/__init__.py rename to neutron/tests/unit/plugins/ibm/__init__.py diff --git a/neutron/tests/unit/ibm/test_sdnve_agent.py b/neutron/tests/unit/plugins/ibm/test_sdnve_agent.py similarity index 100% rename from neutron/tests/unit/ibm/test_sdnve_agent.py rename to neutron/tests/unit/plugins/ibm/test_sdnve_agent.py diff --git a/neutron/tests/unit/ibm/test_sdnve_api.py b/neutron/tests/unit/plugins/ibm/test_sdnve_api.py similarity index 100% rename from neutron/tests/unit/ibm/test_sdnve_api.py rename to neutron/tests/unit/plugins/ibm/test_sdnve_api.py diff --git a/neutron/tests/unit/ibm/test_sdnve_plugin.py b/neutron/tests/unit/plugins/ibm/test_sdnve_plugin.py similarity index 94% rename from neutron/tests/unit/ibm/test_sdnve_plugin.py rename to neutron/tests/unit/plugins/ibm/test_sdnve_plugin.py index 82ba6181f19..525468f157e 100644 --- a/neutron/tests/unit/ibm/test_sdnve_plugin.py +++ b/neutron/tests/unit/plugins/ibm/test_sdnve_plugin.py @@ -20,8 +20,8 @@ import mock from neutron.extensions import portbindings from neutron.tests.unit import _test_extension_portbindings as test_bindings -from neutron.tests.unit import test_db_plugin as test_plugin -from neutron.tests.unit import test_l3_plugin as test_l3_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin +from neutron.tests.unit.extensions import test_l3 as test_l3 from neutron.plugins.ibm.common import constants @@ -111,7 +111,7 @@ class TestIBMPortBinding(IBMPluginV2TestCase, VIF_TYPE = portbindings.VIF_TYPE_OVS -class IBMPluginRouterTestCase(test_l3_plugin.L3NatDBIntTestCase): +class IBMPluginRouterTestCase(test_l3.L3NatDBIntTestCase): def setUp(self): with contextlib.nested( diff --git a/neutron/tests/unit/ml2/drivers/cisco/__init__.py b/neutron/tests/unit/plugins/linuxbridge/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/cisco/__init__.py rename to neutron/tests/unit/plugins/linuxbridge/__init__.py diff --git a/neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py b/neutron/tests/unit/plugins/linuxbridge/test_lb_neutron_agent.py similarity index 100% rename from neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py rename to neutron/tests/unit/plugins/linuxbridge/test_lb_neutron_agent.py diff --git a/neutron/tests/unit/ml2/drivers/cisco/apic/__init__.py b/neutron/tests/unit/plugins/ml2/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/cisco/apic/__init__.py rename to neutron/tests/unit/plugins/ml2/__init__.py diff --git a/neutron/tests/unit/ml2/_test_mech_agent.py b/neutron/tests/unit/plugins/ml2/_test_mech_agent.py similarity index 100% rename from neutron/tests/unit/ml2/_test_mech_agent.py rename to neutron/tests/unit/plugins/ml2/_test_mech_agent.py diff --git a/neutron/tests/unit/ml2/drivers/cisco/ncs/__init__.py b/neutron/tests/unit/plugins/ml2/db/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/cisco/ncs/__init__.py rename to neutron/tests/unit/plugins/ml2/db/__init__.py diff --git a/neutron/tests/unit/ml2/db/test_ml2_db.py b/neutron/tests/unit/plugins/ml2/db/test_ml2_db.py similarity index 100% rename from neutron/tests/unit/ml2/db/test_ml2_db.py rename to neutron/tests/unit/plugins/ml2/db/test_ml2_db.py diff --git a/neutron/tests/unit/ml2/db/test_ml2_dvr_db.py b/neutron/tests/unit/plugins/ml2/db/test_ml2_dvr_db.py similarity index 100% rename from neutron/tests/unit/ml2/db/test_ml2_dvr_db.py rename to neutron/tests/unit/plugins/ml2/db/test_ml2_dvr_db.py diff --git a/neutron/tests/unit/ml2/drivers/freescale/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/freescale/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/__init__.py diff --git a/neutron/tests/unit/ml2/drivers/mech_sriov/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/arista/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/mech_sriov/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/arista/__init__.py diff --git a/neutron/tests/unit/ml2/drivers/arista/test_arista_mechanism_driver.py b/neutron/tests/unit/plugins/ml2/drivers/arista/test_arista_mechanism_driver.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/arista/test_arista_mechanism_driver.py rename to neutron/tests/unit/plugins/ml2/drivers/arista/test_arista_mechanism_driver.py diff --git a/neutron/tests/unit/ml2/extensions/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/__init__.py similarity index 100% rename from neutron/tests/unit/ml2/extensions/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/__init__.py diff --git a/neutron/tests/unit/oneconvergence/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/__init__.py similarity index 100% rename from neutron/tests/unit/oneconvergence/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/__init__.py diff --git a/neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_common.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_common.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_common.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_common.py diff --git a/neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py similarity index 99% rename from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py index 4459e9d4990..50cba5fc801 100644 --- a/neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py @@ -24,7 +24,7 @@ from neutron.extensions import portbindings 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.ml2.drivers.cisco.apic import ( +from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import ( test_cisco_apic_common as mocked) diff --git a/neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_sync.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_sync.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_sync.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_sync.py diff --git a/neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py similarity index 99% rename from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py index 895d3cdfa45..89fefbaeacd 100644 --- a/neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py @@ -21,7 +21,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.ml2.drivers.cisco.apic import ( +from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import ( test_cisco_apic_common as mocked) NOTIFIER = ('neutron.plugins.ml2.drivers.cisco.apic.' diff --git a/neutron/tests/unit/opencontrail/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/__init__.py similarity index 100% rename from neutron/tests/unit/opencontrail/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/__init__.py diff --git a/neutron/tests/unit/ml2/drivers/cisco/ncs/test_mechanism_ncs.py b/neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py similarity index 95% rename from neutron/tests/unit/ml2/drivers/cisco/ncs/test_mechanism_ncs.py rename to neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py index 7aa99035825..d9fe09ad226 100644 --- a/neutron/tests/unit/ml2/drivers/cisco/ncs/test_mechanism_ncs.py +++ b/neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py @@ -14,7 +14,7 @@ # under the License. from neutron.plugins.ml2.drivers.cisco.ncs import driver -from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin class NCSTestCase(test_plugin.Ml2PluginV2TestCase): diff --git a/neutron/tests/unit/ml2/drivers/ext_test.py b/neutron/tests/unit/plugins/ml2/drivers/ext_test.py similarity index 99% rename from neutron/tests/unit/ml2/drivers/ext_test.py rename to neutron/tests/unit/plugins/ml2/drivers/ext_test.py index 45fa4fde938..02b79dc585f 100644 --- a/neutron/tests/unit/ml2/drivers/ext_test.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ext_test.py @@ -26,7 +26,7 @@ from neutron.api.v2 import attributes from neutron.db import model_base from neutron.db import models_v2 from neutron.plugins.ml2 import driver_api -from neutron.tests.unit.ml2 import extensions as test_extensions +from neutron.tests.unit.plugins.ml2 import extensions as test_extensions class TestExtensionDriverBase(driver_api.ExtensionDriver): diff --git a/neutron/tests/unit/openvswitch/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/freescale/__init__.py similarity index 100% rename from neutron/tests/unit/openvswitch/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/freescale/__init__.py diff --git a/neutron/tests/unit/ml2/drivers/freescale/test_mechanism_fslsdn.py b/neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py similarity index 99% rename from neutron/tests/unit/ml2/drivers/freescale/test_mechanism_fslsdn.py rename to neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py index 40c881488c2..04b0e8fb129 100644 --- a/neutron/tests/unit/ml2/drivers/freescale/test_mechanism_fslsdn.py +++ b/neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py @@ -19,7 +19,7 @@ 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.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin """Unit testing for Freescale SDN mechanism driver.""" diff --git a/neutron/tests/unit/ml2/drivers/mech_fake_agent.py b/neutron/tests/unit/plugins/ml2/drivers/mech_fake_agent.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/mech_fake_agent.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_fake_agent.py diff --git a/neutron/tests/unit/sriovnicagent/__init__.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/__init__.py similarity index 100% rename from neutron/tests/unit/sriovnicagent/__init__.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/__init__.py diff --git a/neutron/tests/unit/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py similarity index 99% rename from neutron/tests/unit/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py index 14dffd4d333..5a866c7c4b7 100644 --- a/neutron/tests/unit/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py @@ -24,7 +24,7 @@ from neutron.plugins.ml2 import config # noqa from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers.mech_sriov import exceptions as exc from neutron.plugins.ml2.drivers.mech_sriov import mech_driver -from neutron.tests.unit.ml2 import _test_mech_agent as base +from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base MELLANOX_CONNECTX3_PCI_INFO = '15b3:1004' DEFAULT_PCI_INFO = ['15b3:1004', '8086:10ca'] diff --git a/neutron/tests/unit/ml2/drivers/mechanism_logger.py b/neutron/tests/unit/plugins/ml2/drivers/mechanism_logger.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/mechanism_logger.py rename to neutron/tests/unit/plugins/ml2/drivers/mechanism_logger.py diff --git a/neutron/tests/unit/ml2/drivers/mechanism_test.py b/neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py similarity index 100% rename from neutron/tests/unit/ml2/drivers/mechanism_test.py rename to neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py diff --git a/neutron/tests/unit/ml2/drivers/test_l2population.py b/neutron/tests/unit/plugins/ml2/drivers/test_l2population.py similarity index 99% rename from neutron/tests/unit/ml2/drivers/test_l2population.py rename to neutron/tests/unit/plugins/ml2/drivers/test_l2population.py index 5b57c9e41d5..d0f97215812 100644 --- a/neutron/tests/unit/ml2/drivers/test_l2population.py +++ b/neutron/tests/unit/plugins/ml2/drivers/test_l2population.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.ml2 import test_ml2_plugin as test_plugin +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin HOST = 'my_l2_host' L2_AGENT = { diff --git a/neutron/tests/unit/ml2/drivers/test_mech_mlnx.py b/neutron/tests/unit/plugins/ml2/drivers/test_mech_mlnx.py similarity index 98% rename from neutron/tests/unit/ml2/drivers/test_mech_mlnx.py rename to neutron/tests/unit/plugins/ml2/drivers/test_mech_mlnx.py index 6ccbe8658bb..c055fa225ba 100644 --- a/neutron/tests/unit/ml2/drivers/test_mech_mlnx.py +++ b/neutron/tests/unit/plugins/ml2/drivers/test_mech_mlnx.py @@ -18,7 +18,7 @@ import mock from neutron.common import constants from neutron.extensions import portbindings from neutron.plugins.ml2 import driver_api as api -from neutron.tests.unit.ml2 import _test_mech_agent as base +from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base m_const_mock = mock.Mock() diff --git a/neutron/tests/unit/plugins/ml2/extensions/__init__.py b/neutron/tests/unit/plugins/ml2/extensions/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/ml2/extensions/test_extension.py b/neutron/tests/unit/plugins/ml2/extensions/test_extension.py similarity index 100% rename from neutron/tests/unit/ml2/extensions/test_extension.py rename to neutron/tests/unit/plugins/ml2/extensions/test_extension.py diff --git a/neutron/tests/unit/ml2/test_agent_scheduler.py b/neutron/tests/unit/plugins/ml2/test_agent_scheduler.py similarity index 90% rename from neutron/tests/unit/ml2/test_agent_scheduler.py rename to neutron/tests/unit/plugins/ml2/test_agent_scheduler.py index fbf94a1b19c..a55645cd6bd 100644 --- a/neutron/tests/unit/ml2/test_agent_scheduler.py +++ b/neutron/tests/unit/plugins/ml2/test_agent_scheduler.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.tests.unit.ml2 import test_ml2_plugin -from neutron.tests.unit.openvswitch import test_agent_scheduler +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.openvswitch import test_agent_scheduler class Ml2AgentSchedulerTestCase( diff --git a/neutron/tests/unit/ml2/test_driver_context.py b/neutron/tests/unit/plugins/ml2/test_driver_context.py similarity index 100% rename from neutron/tests/unit/ml2/test_driver_context.py rename to neutron/tests/unit/plugins/ml2/test_driver_context.py diff --git a/neutron/tests/unit/ml2/test_ext_portsecurity.py b/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py similarity index 89% rename from neutron/tests/unit/ml2/test_ext_portsecurity.py rename to neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py index 28fa68dcbb9..9b0d2eeadf5 100644 --- a/neutron/tests/unit/ml2/test_ext_portsecurity.py +++ b/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py @@ -14,8 +14,8 @@ # under the License. from neutron.plugins.ml2 import config -from neutron.tests.unit.ml2 import test_ml2_plugin -from neutron.tests.unit import test_extension_portsecurity as test_psec +from neutron.tests.unit.extensions import test_portsecurity as test_psec +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin class PSExtDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase, diff --git a/neutron/tests/unit/ml2/test_extension_driver_api.py b/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py similarity index 98% rename from neutron/tests/unit/ml2/test_extension_driver_api.py rename to neutron/tests/unit/plugins/ml2/test_extension_driver_api.py index 689dd79a99d..5fc42216307 100644 --- a/neutron/tests/unit/ml2/test_extension_driver_api.py +++ b/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py @@ -16,8 +16,8 @@ import mock from neutron import context from neutron import manager from neutron.plugins.ml2 import config -from neutron.tests.unit.ml2.drivers import ext_test -from neutron.tests.unit.ml2 import test_ml2_plugin +from neutron.tests.unit.plugins.ml2.drivers import ext_test +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin class ExtensionDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase): diff --git a/neutron/tests/unit/ml2/test_helpers.py b/neutron/tests/unit/plugins/ml2/test_helpers.py similarity index 100% rename from neutron/tests/unit/ml2/test_helpers.py rename to neutron/tests/unit/plugins/ml2/test_helpers.py diff --git a/neutron/tests/unit/ml2/test_mech_linuxbridge.py b/neutron/tests/unit/plugins/ml2/test_mech_linuxbridge.py similarity index 97% rename from neutron/tests/unit/ml2/test_mech_linuxbridge.py rename to neutron/tests/unit/plugins/ml2/test_mech_linuxbridge.py index 6fc708b0ace..ed728548b5b 100644 --- a/neutron/tests/unit/ml2/test_mech_linuxbridge.py +++ b/neutron/tests/unit/plugins/ml2/test_mech_linuxbridge.py @@ -16,7 +16,7 @@ from neutron.common import constants from neutron.extensions import portbindings from neutron.plugins.ml2.drivers import mech_linuxbridge -from neutron.tests.unit.ml2 import _test_mech_agent as base +from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base class LinuxbridgeMechanismBaseTestCase(base.AgentMechanismBaseTestCase): diff --git a/neutron/tests/unit/ml2/test_mech_openvswitch.py b/neutron/tests/unit/plugins/ml2/test_mech_openvswitch.py similarity index 98% rename from neutron/tests/unit/ml2/test_mech_openvswitch.py rename to neutron/tests/unit/plugins/ml2/test_mech_openvswitch.py index b7b3be8e604..51303ba5a93 100644 --- a/neutron/tests/unit/ml2/test_mech_openvswitch.py +++ b/neutron/tests/unit/plugins/ml2/test_mech_openvswitch.py @@ -18,7 +18,7 @@ from oslo_config import cfg from neutron.common import constants from neutron.extensions import portbindings from neutron.plugins.ml2.drivers import mech_openvswitch -from neutron.tests.unit.ml2 import _test_mech_agent as base +from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base class OpenvswitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase): diff --git a/neutron/tests/unit/ml2/test_mechanism_odl.py b/neutron/tests/unit/plugins/ml2/test_mechanism_odl.py similarity index 98% rename from neutron/tests/unit/ml2/test_mechanism_odl.py rename to neutron/tests/unit/plugins/ml2/test_mechanism_odl.py index 958e7d13411..89161ac2002 100644 --- a/neutron/tests/unit/ml2/test_mechanism_odl.py +++ b/neutron/tests/unit/plugins/ml2/test_mechanism_odl.py @@ -17,7 +17,7 @@ import sys import mock from neutron import context -from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin +from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin with mock.patch.dict(sys.modules, diff --git a/neutron/tests/unit/ml2/test_ml2_plugin.py b/neutron/tests/unit/plugins/ml2/test_ml2_plugin.py similarity index 99% rename from neutron/tests/unit/ml2/test_ml2_plugin.py rename to neutron/tests/unit/plugins/ml2/test_ml2_plugin.py index 1b770c00ed2..e9cd744064d 100644 --- a/neutron/tests/unit/ml2/test_ml2_plugin.py +++ b/neutron/tests/unit/plugins/ml2/test_ml2_plugin.py @@ -48,12 +48,13 @@ from neutron.plugins.ml2 import models from neutron.plugins.ml2 import plugin as ml2_plugin from neutron.tests import base from neutron.tests.unit import _test_extension_portbindings as test_bindings -from neutron.tests.unit.ml2.drivers import mechanism_logger as mech_logger -from neutron.tests.unit.ml2.drivers import mechanism_test as mech_test -from neutron.tests.unit import test_db_plugin as test_plugin -from neutron.tests.unit import test_extension_allowedaddresspairs as test_pair -from neutron.tests.unit import test_extension_extradhcpopts as test_dhcpopts -from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc +from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc +from neutron.tests.unit.db import test_allowedaddresspairs_db as test_pair +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin +from neutron.tests.unit.extensions import test_extra_dhcp_opt as test_dhcpopts +from neutron.tests.unit.plugins.ml2.drivers import mechanism_logger as \ + mech_logger +from neutron.tests.unit.plugins.ml2.drivers import mechanism_test as mech_test config.cfg.CONF.import_opt('network_vlan_ranges', @@ -93,7 +94,7 @@ class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase): def setup_parent(self): """Perform parent setup with the common plugin configuration class.""" - l3_plugin = ('neutron.tests.unit.test_l3_plugin.' + l3_plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatServicePlugin') service_plugins = {'l3_plugin_name': l3_plugin} # Ensure that the parent setup can be called without arguments diff --git a/neutron/tests/unit/ml2/test_port_binding.py b/neutron/tests/unit/plugins/ml2/test_port_binding.py similarity index 99% rename from neutron/tests/unit/ml2/test_port_binding.py rename to neutron/tests/unit/plugins/ml2/test_port_binding.py index 83dca2d2f67..8939c4f2d63 100644 --- a/neutron/tests/unit/ml2/test_port_binding.py +++ b/neutron/tests/unit/plugins/ml2/test_port_binding.py @@ -20,7 +20,7 @@ from neutron.extensions import portbindings from neutron import manager from neutron.plugins.ml2 import config as config from neutron.plugins.ml2 import models as ml2_models -from neutron.tests.unit import test_db_plugin as test_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin' diff --git a/neutron/tests/unit/ml2/test_rpcapi.py b/neutron/tests/unit/plugins/ml2/test_rpcapi.py similarity index 100% rename from neutron/tests/unit/ml2/test_rpcapi.py rename to neutron/tests/unit/plugins/ml2/test_rpcapi.py diff --git a/neutron/tests/unit/ml2/test_security_group.py b/neutron/tests/unit/plugins/ml2/test_security_group.py similarity index 95% rename from neutron/tests/unit/ml2/test_security_group.py rename to neutron/tests/unit/plugins/ml2/test_security_group.py index c7d5a22faa2..6b1c3d01695 100644 --- a/neutron/tests/unit/ml2/test_security_group.py +++ b/neutron/tests/unit/plugins/ml2/test_security_group.py @@ -22,9 +22,9 @@ from neutron.api.v2 import attributes from neutron.common import constants as const from neutron.extensions import securitygroup as ext_sg from neutron import manager -from neutron.tests.unit import test_api_v2 -from neutron.tests.unit import test_extension_security_group as test_sg -from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc +from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc +from neutron.tests.unit.api.v2 import test_base +from neutron.tests.unit.extensions import test_securitygroup as test_sg PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin' NOTIFIER = 'neutron.plugins.ml2.rpc.AgentNotifierApi' @@ -150,8 +150,8 @@ class TestMl2SecurityGroups(Ml2SecurityGroupsTestCase, # return no ports to exit the method early since we are mocking # the query fmock.return_value.all.return_value = [] - plugin.get_ports_from_devices([test_api_v2._uuid(), - test_api_v2._uuid()]) + plugin.get_ports_from_devices([test_base._uuid(), + test_base._uuid()]) # the or_ function should only have one argument or_mock.assert_called_once_with(mock.ANY) diff --git a/neutron/tests/unit/ml2/test_type_flat.py b/neutron/tests/unit/plugins/ml2/test_type_flat.py similarity index 100% rename from neutron/tests/unit/ml2/test_type_flat.py rename to neutron/tests/unit/plugins/ml2/test_type_flat.py diff --git a/neutron/tests/unit/ml2/test_type_gre.py b/neutron/tests/unit/plugins/ml2/test_type_gre.py similarity index 98% rename from neutron/tests/unit/ml2/test_type_gre.py rename to neutron/tests/unit/plugins/ml2/test_type_gre.py index 933da29361d..fba76f92cec 100644 --- a/neutron/tests/unit/ml2/test_type_gre.py +++ b/neutron/tests/unit/plugins/ml2/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.ml2 import test_rpcapi -from neutron.tests.unit.ml2 import test_type_tunnel +from neutron.tests.unit.plugins.ml2 import test_rpcapi +from neutron.tests.unit.plugins.ml2 import test_type_tunnel from neutron.tests.unit import testlib_api diff --git a/neutron/tests/unit/ml2/test_type_local.py b/neutron/tests/unit/plugins/ml2/test_type_local.py similarity index 100% rename from neutron/tests/unit/ml2/test_type_local.py rename to neutron/tests/unit/plugins/ml2/test_type_local.py diff --git a/neutron/tests/unit/ml2/test_type_tunnel.py b/neutron/tests/unit/plugins/ml2/test_type_tunnel.py similarity index 100% rename from neutron/tests/unit/ml2/test_type_tunnel.py rename to neutron/tests/unit/plugins/ml2/test_type_tunnel.py diff --git a/neutron/tests/unit/ml2/test_type_vlan.py b/neutron/tests/unit/plugins/ml2/test_type_vlan.py similarity index 100% rename from neutron/tests/unit/ml2/test_type_vlan.py rename to neutron/tests/unit/plugins/ml2/test_type_vlan.py diff --git a/neutron/tests/unit/ml2/test_type_vxlan.py b/neutron/tests/unit/plugins/ml2/test_type_vxlan.py similarity index 97% rename from neutron/tests/unit/ml2/test_type_vxlan.py rename to neutron/tests/unit/plugins/ml2/test_type_vxlan.py index 3487c7f4534..b76b0094f25 100644 --- a/neutron/tests/unit/ml2/test_type_vxlan.py +++ b/neutron/tests/unit/plugins/ml2/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.ml2 import test_rpcapi -from neutron.tests.unit.ml2 import test_type_tunnel +from neutron.tests.unit.plugins.ml2 import test_rpcapi +from neutron.tests.unit.plugins.ml2 import test_type_tunnel from neutron.tests.unit import testlib_api diff --git a/neutron/tests/unit/plugins/oneconvergence/__init__.py b/neutron/tests/unit/plugins/oneconvergence/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/oneconvergence/test_nvsd_agent.py b/neutron/tests/unit/plugins/oneconvergence/test_nvsd_agent.py similarity index 100% rename from neutron/tests/unit/oneconvergence/test_nvsd_agent.py rename to neutron/tests/unit/plugins/oneconvergence/test_nvsd_agent.py diff --git a/neutron/tests/unit/oneconvergence/test_nvsd_plugin.py b/neutron/tests/unit/plugins/oneconvergence/test_nvsd_plugin.py similarity index 94% rename from neutron/tests/unit/oneconvergence/test_nvsd_plugin.py rename to neutron/tests/unit/plugins/oneconvergence/test_nvsd_plugin.py index c902cee6425..f8ac5f48070 100644 --- a/neutron/tests/unit/oneconvergence/test_nvsd_plugin.py +++ b/neutron/tests/unit/plugins/oneconvergence/test_nvsd_plugin.py @@ -26,8 +26,8 @@ from neutron.extensions import portbindings from neutron import manager from neutron.plugins.oneconvergence import plugin as nvsd_plugin from neutron.tests.unit import _test_extension_portbindings as test_bindings -from neutron.tests.unit import test_db_plugin as test_plugin -from neutron.tests.unit import test_l3_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin +from neutron.tests.unit.extensions import test_l3 PLUGIN_NAME = 'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2' @@ -98,7 +98,7 @@ class TestOneConvergenceV2HTTPResponse(test_plugin.TestV2HTTPResponse, pass -class TestOneConvergenceL3NatTestCase(test_l3_plugin.L3NatDBIntTestCase): +class TestOneConvergenceL3NatTestCase(test_l3.L3NatDBIntTestCase): _plugin_name = PLUGIN_NAME def setUp(self): @@ -112,7 +112,7 @@ class TestOneConvergenceL3NatTestCase(test_l3_plugin.L3NatDBIntTestCase): self.nvsdlib = mock.Mock() self.nvsdlib.create_network.side_effect = side_effect - ext_mgr = test_l3_plugin.L3TestExtensionManager() + ext_mgr = test_l3.L3TestExtensionManager() with mock.patch.object(nvsd_plugin.OneConvergencePluginV2, 'oneconvergence_init', diff --git a/neutron/tests/unit/oneconvergence/test_nvsdlib.py b/neutron/tests/unit/plugins/oneconvergence/test_nvsdlib.py similarity index 100% rename from neutron/tests/unit/oneconvergence/test_nvsdlib.py rename to neutron/tests/unit/plugins/oneconvergence/test_nvsdlib.py diff --git a/neutron/tests/unit/oneconvergence/test_plugin_helper.py b/neutron/tests/unit/plugins/oneconvergence/test_plugin_helper.py similarity index 100% rename from neutron/tests/unit/oneconvergence/test_plugin_helper.py rename to neutron/tests/unit/plugins/oneconvergence/test_plugin_helper.py diff --git a/neutron/tests/unit/oneconvergence/test_security_group.py b/neutron/tests/unit/plugins/oneconvergence/test_security_group.py similarity index 94% rename from neutron/tests/unit/oneconvergence/test_security_group.py rename to neutron/tests/unit/plugins/oneconvergence/test_security_group.py index db245509ab9..9820f9cfdf3 100644 --- a/neutron/tests/unit/oneconvergence/test_security_group.py +++ b/neutron/tests/unit/plugins/oneconvergence/test_security_group.py @@ -20,14 +20,15 @@ from neutron.api.v2 import attributes from neutron.extensions import securitygroup as ext_sg from neutron import manager from neutron.plugins.oneconvergence import plugin as nvsd_plugin -from neutron.tests.unit import test_extension_security_group as test_sg -from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc +from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc +from neutron.tests.unit.extensions import test_securitygroup as test_sg PLUGIN_NAME = ('neutron.plugins.oneconvergence.' 'plugin.OneConvergencePluginV2') AGENTNOTIFIER = ('neutron.plugins.oneconvergence.' 'plugin.NVSDPluginV2AgentNotifierApi') -DUMMY_NVSD_LIB = ('neutron.tests.unit.oneconvergence.dummynvsdlib.NVSDApi') +DUMMY_NVSD_LIB = ('neutron.tests.unit.plugins.oneconvergence.' + 'dummynvsdlib.NVSDApi') class OneConvergenceSecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase): diff --git a/neutron/tests/unit/plugins/opencontrail/__init__.py b/neutron/tests/unit/plugins/opencontrail/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/opencontrail/test_contrail_plugin.py b/neutron/tests/unit/plugins/opencontrail/test_contrail_plugin.py similarity index 97% rename from neutron/tests/unit/opencontrail/test_contrail_plugin.py rename to neutron/tests/unit/plugins/opencontrail/test_contrail_plugin.py index 926b040de66..c79bd701ff5 100644 --- a/neutron/tests/unit/opencontrail/test_contrail_plugin.py +++ b/neutron/tests/unit/plugins/opencontrail/test_contrail_plugin.py @@ -36,10 +36,10 @@ from neutron.db import securitygroups_db from neutron.extensions import portbindings from neutron.extensions import securitygroup as ext_sg from neutron.tests.unit import _test_extension_portbindings as test_bindings -from neutron.tests.unit import test_db_plugin as test_plugin -from neutron.tests.unit import test_extension_security_group as test_sg -from neutron.tests.unit import test_extensions -from neutron.tests.unit import test_l3_plugin +from neutron.tests.unit.api import test_extensions +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin +from neutron.tests.unit.extensions import test_l3 +from neutron.tests.unit.extensions import test_securitygroup as test_sg CONTRAIL_PKG_PATH = "neutron.plugins.opencontrail.contrail_plugin" @@ -310,7 +310,7 @@ class TestContrailPortBinding(ContrailPluginTestCase, class TestContrailL3NatTestCase(ContrailPluginTestCase, - test_l3_plugin.L3NatDBIntTestCase): + test_l3.L3NatDBIntTestCase): mock_rescheduling = False def setUp(self): diff --git a/neutron/tests/unit/plugins/openvswitch/__init__.py b/neutron/tests/unit/plugins/openvswitch/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/openvswitch/test_agent_scheduler.py b/neutron/tests/unit/plugins/openvswitch/test_agent_scheduler.py similarity index 98% rename from neutron/tests/unit/openvswitch/test_agent_scheduler.py rename to neutron/tests/unit/plugins/openvswitch/test_agent_scheduler.py index 727fbbff1d1..10eb7b20973 100644 --- a/neutron/tests/unit/openvswitch/test_agent_scheduler.py +++ b/neutron/tests/unit/plugins/openvswitch/test_agent_scheduler.py @@ -41,10 +41,10 @@ from neutron import manager from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants from neutron.tests import fake_notifier -from neutron.tests.unit import test_agent_ext_plugin -from neutron.tests.unit import test_db_plugin as test_plugin -from neutron.tests.unit import test_extensions -from neutron.tests.unit import test_l3_plugin +from neutron.tests.unit.api import test_extensions +from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin +from neutron.tests.unit.extensions import test_agent +from neutron.tests.unit.extensions import test_l3 from neutron.tests.unit import testlib_api from neutron import wsgi @@ -200,13 +200,13 @@ class AgentSchedulerTestMixIn(object): return agent_data['id'] -class OvsAgentSchedulerTestCaseBase(test_l3_plugin.L3NatTestCaseMixin, - test_agent_ext_plugin.AgentDBTestMixIn, +class OvsAgentSchedulerTestCaseBase(test_l3.L3NatTestCaseMixin, + test_agent.AgentDBTestMixIn, AgentSchedulerTestMixIn, test_plugin.NeutronDbPluginV2TestCase): fmt = 'json' plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin' - l3_plugin = ('neutron.tests.unit.test_l3_plugin.' + l3_plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatAgentSchedulingServicePlugin') def setUp(self): @@ -1265,8 +1265,8 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase): exc.HTTPNotFound.code) -class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin, - test_agent_ext_plugin.AgentDBTestMixIn, +class OvsDhcpAgentNotifierTestCase(test_l3.L3NatTestCaseMixin, + test_agent.AgentDBTestMixIn, AgentSchedulerTestMixIn, test_plugin.NeutronDbPluginV2TestCase): plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin' @@ -1424,12 +1424,12 @@ class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin, self.assertTrue(self._is_schedule_network_called(device_id)) -class OvsL3AgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin, - test_agent_ext_plugin.AgentDBTestMixIn, +class OvsL3AgentNotifierTestCase(test_l3.L3NatTestCaseMixin, + test_agent.AgentDBTestMixIn, AgentSchedulerTestMixIn, test_plugin.NeutronDbPluginV2TestCase): plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin' - l3_plugin = ('neutron.tests.unit.test_l3_plugin.' + l3_plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatAgentSchedulingServicePlugin') def setUp(self): diff --git a/neutron/tests/unit/openvswitch/test_ovs_dvr_neutron_agent.py b/neutron/tests/unit/plugins/openvswitch/test_ovs_dvr_neutron_agent.py similarity index 100% rename from neutron/tests/unit/openvswitch/test_ovs_dvr_neutron_agent.py rename to neutron/tests/unit/plugins/openvswitch/test_ovs_dvr_neutron_agent.py diff --git a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/openvswitch/test_ovs_neutron_agent.py similarity index 100% rename from neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py rename to neutron/tests/unit/plugins/openvswitch/test_ovs_neutron_agent.py diff --git a/neutron/tests/unit/openvswitch/test_ovs_tunnel.py b/neutron/tests/unit/plugins/openvswitch/test_ovs_tunnel.py similarity index 100% rename from neutron/tests/unit/openvswitch/test_ovs_tunnel.py rename to neutron/tests/unit/plugins/openvswitch/test_ovs_tunnel.py diff --git a/neutron/tests/unit/plugins/sriovnicagent/__init__.py b/neutron/tests/unit/plugins/sriovnicagent/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/sriovnicagent/test_eswitch_manager.py b/neutron/tests/unit/plugins/sriovnicagent/test_eswitch_manager.py similarity index 100% rename from neutron/tests/unit/sriovnicagent/test_eswitch_manager.py rename to neutron/tests/unit/plugins/sriovnicagent/test_eswitch_manager.py diff --git a/neutron/tests/unit/sriovnicagent/test_pci_lib.py b/neutron/tests/unit/plugins/sriovnicagent/test_pci_lib.py similarity index 100% rename from neutron/tests/unit/sriovnicagent/test_pci_lib.py rename to neutron/tests/unit/plugins/sriovnicagent/test_pci_lib.py diff --git a/neutron/tests/unit/sriovnicagent/test_sriov_agent_config.py b/neutron/tests/unit/plugins/sriovnicagent/test_sriov_agent_config.py similarity index 100% rename from neutron/tests/unit/sriovnicagent/test_sriov_agent_config.py rename to neutron/tests/unit/plugins/sriovnicagent/test_sriov_agent_config.py diff --git a/neutron/tests/unit/sriovnicagent/test_sriov_neutron_agent.py b/neutron/tests/unit/plugins/sriovnicagent/test_sriov_neutron_agent.py similarity index 100% rename from neutron/tests/unit/sriovnicagent/test_sriov_neutron_agent.py rename to neutron/tests/unit/plugins/sriovnicagent/test_sriov_neutron_agent.py diff --git a/neutron/tests/unit/scheduler/__init__.py b/neutron/tests/unit/scheduler/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/test_dhcp_scheduler.py b/neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py similarity index 100% rename from neutron/tests/unit/test_dhcp_scheduler.py rename to neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py diff --git a/neutron/tests/unit/test_l3_schedulers.py b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py similarity index 99% rename from neutron/tests/unit/test_l3_schedulers.py rename to neutron/tests/unit/scheduler/test_l3_agent_scheduler.py index b9877b31fdb..267eceefa32 100644 --- a/neutron/tests/unit/test_l3_schedulers.py +++ b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py @@ -41,8 +41,8 @@ from neutron.extensions import l3agentscheduler as l3agent from neutron import manager from neutron.scheduler import l3_agent_scheduler from neutron.tests import base -from neutron.tests.unit import test_db_plugin -from neutron.tests.unit import test_l3_plugin +from neutron.tests.unit.db import test_db_base_plugin_v2 +from neutron.tests.unit.extensions import test_l3 from neutron.tests.unit import testlib_api # the below code is required for the following reason @@ -723,15 +723,15 @@ class L3SchedulerTestBaseMixin(object): class L3SchedulerTestCase(l3_agentschedulers_db.L3AgentSchedulerDbMixin, l3_db.L3_NAT_db_mixin, common_db_mixin.CommonDbMixin, - test_db_plugin.NeutronDbPluginV2TestCase, - test_l3_plugin.L3NatTestCaseMixin, + test_db_base_plugin_v2.NeutronDbPluginV2TestCase, + test_l3.L3NatTestCaseMixin, L3SchedulerBaseMixin, L3SchedulerTestBaseMixin): def setUp(self): self.mock_rescheduling = False - ext_mgr = test_l3_plugin.L3TestExtensionManager() - plugin_str = ('neutron.tests.unit.test_l3_plugin.' + ext_mgr = test_l3.L3TestExtensionManager() + plugin_str = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatIntAgentSchedulingPlugin') super(L3SchedulerTestCase, self).setUp(plugin=plugin_str, ext_mgr=ext_mgr) diff --git a/neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py b/neutron/tests/unit/services/l3_router/test_l3_apic.py similarity index 98% rename from neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py rename to neutron/tests/unit/services/l3_router/test_l3_apic.py index 12b8c808a39..536c10e7a76 100644 --- a/neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py +++ b/neutron/tests/unit/services/l3_router/test_l3_apic.py @@ -21,7 +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.ml2.drivers.cisco.apic import ( +from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import ( test_cisco_apic_common as mocked) from neutron.tests.unit import testlib_api diff --git a/neutron/tests/unit/services/metering/agents/__init__.py b/neutron/tests/unit/services/metering/agents/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/services/metering/test_metering_agent.py b/neutron/tests/unit/services/metering/agents/test_metering_agent.py similarity index 100% rename from neutron/tests/unit/services/metering/test_metering_agent.py rename to neutron/tests/unit/services/metering/agents/test_metering_agent.py diff --git a/neutron/tests/unit/services/metering/drivers/test_iptables_driver.py b/neutron/tests/unit/services/metering/drivers/test_iptables.py similarity index 99% rename from neutron/tests/unit/services/metering/drivers/test_iptables_driver.py rename to neutron/tests/unit/services/metering/drivers/test_iptables.py index c1474f45174..5818a9775d3 100644 --- a/neutron/tests/unit/services/metering/drivers/test_iptables_driver.py +++ b/neutron/tests/unit/services/metering/drivers/test_iptables.py @@ -19,9 +19,9 @@ from oslo_config import cfg from neutron.services.metering.drivers.iptables import iptables_driver from neutron.tests import base -from neutron.tests.unit import test_api_v2 +from neutron.tests.unit.api.v2 import test_base -_uuid = test_api_v2._uuid +_uuid = test_base._uuid TEST_ROUTERS = [ diff --git a/neutron/tests/unit/services/metering/test_metering_plugin.py b/neutron/tests/unit/services/metering/test_metering_plugin.py index 90d01985275..bd086b2230d 100644 --- a/neutron/tests/unit/services/metering/test_metering_plugin.py +++ b/neutron/tests/unit/services/metering/test_metering_plugin.py @@ -27,9 +27,9 @@ from neutron.extensions import metering as ext_metering from neutron import manager from neutron.openstack.common import uuidutils from neutron.plugins.common import constants -from neutron.tests.unit.db.metering import test_db_metering -from neutron.tests.unit import test_db_plugin -from neutron.tests.unit import test_l3_plugin +from neutron.tests.unit.db.metering import test_metering_db +from neutron.tests.unit.db import test_db_base_plugin_v2 +from neutron.tests.unit.extensions import test_l3 _uuid = uuidutils.generate_uuid @@ -58,9 +58,9 @@ class MeteringTestExtensionManager(object): return [] -class TestMeteringPlugin(test_db_plugin.NeutronDbPluginV2TestCase, - test_l3_plugin.L3NatTestCaseMixin, - test_db_metering.MeteringPluginDbTestCaseMixin): +class TestMeteringPlugin(test_db_base_plugin_v2.NeutronDbPluginV2TestCase, + test_l3.L3NatTestCaseMixin, + test_metering_db.MeteringPluginDbTestCaseMixin): resource_prefix_map = dict( (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING]) @@ -68,7 +68,7 @@ class TestMeteringPlugin(test_db_plugin.NeutronDbPluginV2TestCase, ) def setUp(self): - plugin = 'neutron.tests.unit.test_l3_plugin.TestL3NatIntPlugin' + plugin = 'neutron.tests.unit.extensions.test_l3.TestL3NatIntPlugin' service_plugins = {'metering_plugin_name': METERING_SERVICE_PLUGIN_KLASS} ext_mgr = MeteringTestExtensionManager() @@ -277,9 +277,9 @@ class TestMeteringPlugin(test_db_plugin.NeutronDbPluginV2TestCase, class TestMeteringPluginL3AgentScheduler( l3_agentschedulers_db.L3AgentSchedulerDbMixin, - test_db_plugin.NeutronDbPluginV2TestCase, - test_l3_plugin.L3NatTestCaseMixin, - test_db_metering.MeteringPluginDbTestCaseMixin): + test_db_base_plugin_v2.NeutronDbPluginV2TestCase, + test_l3.L3NatTestCaseMixin, + test_metering_db.MeteringPluginDbTestCaseMixin): resource_prefix_map = dict( (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING]) @@ -288,7 +288,7 @@ class TestMeteringPluginL3AgentScheduler( def setUp(self, plugin_str=None, service_plugins=None, scheduler=None): if not plugin_str: - plugin_str = ('neutron.tests.unit.test_l3_plugin.' + plugin_str = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatIntAgentSchedulingPlugin') if not service_plugins: @@ -384,13 +384,13 @@ class TestMeteringPluginL3AgentSchedulerServicePlugin( """ def setUp(self): - l3_plugin = ('neutron.tests.unit.test_l3_plugin.' + l3_plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatAgentSchedulingServicePlugin') service_plugins = {'metering_plugin_name': METERING_SERVICE_PLUGIN_KLASS, 'l3_plugin_name': l3_plugin} - plugin_str = ('neutron.tests.unit.test_l3_plugin.' + plugin_str = ('neutron.tests.unit.extensions.test_l3.' 'TestNoL3NatPlugin') super(TestMeteringPluginL3AgentSchedulerServicePlugin, self).setUp( @@ -399,9 +399,9 @@ class TestMeteringPluginL3AgentSchedulerServicePlugin( class TestMeteringPluginRpcFromL3Agent( - test_db_plugin.NeutronDbPluginV2TestCase, - test_l3_plugin.L3NatTestCaseMixin, - test_db_metering.MeteringPluginDbTestCaseMixin): + test_db_base_plugin_v2.NeutronDbPluginV2TestCase, + test_l3.L3NatTestCaseMixin, + test_metering_db.MeteringPluginDbTestCaseMixin): resource_prefix_map = dict( (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING]) @@ -412,7 +412,7 @@ class TestMeteringPluginRpcFromL3Agent( service_plugins = {'metering_plugin_name': METERING_SERVICE_PLUGIN_KLASS} - plugin = ('neutron.tests.unit.test_l3_plugin.' + plugin = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatIntAgentSchedulingPlugin') ext_mgr = MeteringTestExtensionManager() diff --git a/neutron/tests/unit/test_provider_configuration.py b/neutron/tests/unit/services/test_provider_configuration.py similarity index 100% rename from neutron/tests/unit/test_provider_configuration.py rename to neutron/tests/unit/services/test_provider_configuration.py diff --git a/neutron/tests/unit/test_neutron_context.py b/neutron/tests/unit/test_context.py similarity index 100% rename from neutron/tests/unit/test_neutron_context.py rename to neutron/tests/unit/test_context.py diff --git a/neutron/tests/unit/ipam/test_ipam.py b/neutron/tests/unit/test_ipam.py similarity index 100% rename from neutron/tests/unit/ipam/test_ipam.py rename to neutron/tests/unit/test_ipam.py diff --git a/neutron/tests/unit/test_neutron_manager.py b/neutron/tests/unit/test_manager.py similarity index 96% rename from neutron/tests/unit/test_neutron_manager.py rename to neutron/tests/unit/test_manager.py index fc2744d4f2e..a29a9d63b46 100644 --- a/neutron/tests/unit/test_neutron_manager.py +++ b/neutron/tests/unit/test_manager.py @@ -96,14 +96,14 @@ class NeutronManagerTestCase(base.BaseTestCase): ["neutron.tests.unit.dummy_plugin." "DummyServicePlugin"]) cfg.CONF.set_override("core_plugin", - "neutron.tests.unit.test_neutron_manager." + "neutron.tests.unit.test_manager." "MultiServiceCorePlugin") e = self.assertRaises(ValueError, manager.NeutronManager.get_instance) self.assertIn(constants.DUMMY, e.message) def test_core_plugin_supports_services(self): cfg.CONF.set_override("core_plugin", - "neutron.tests.unit.test_neutron_manager." + "neutron.tests.unit.test_manager." "MultiServiceCorePlugin") mgr = manager.NeutronManager.get_instance() svc_plugins = mgr.get_service_plugins() @@ -134,7 +134,7 @@ class NeutronManagerTestCase(base.BaseTestCase): ["neutron.tests.unit.dummy_plugin." "DummyServicePlugin"]) cfg.CONF.set_override("core_plugin", - "neutron.tests.unit.test_neutron_manager." + "neutron.tests.unit.test_manager." "CorePluginWithAgentNotifiers") expected = {'l3': 'l3_agent_notifier', 'dhcp': 'dhcp_agent_notifier', diff --git a/neutron/tests/unit/tests/__init__.py b/neutron/tests/unit/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/neutron/tests/unit/test_basetestcase.py b/neutron/tests/unit/tests/test_base.py similarity index 100% rename from neutron/tests/unit/test_basetestcase.py rename to neutron/tests/unit/tests/test_base.py diff --git a/neutron/tests/unit/test_post_mortem_debug.py b/neutron/tests/unit/tests/test_post_mortem_debug.py similarity index 100% rename from neutron/tests/unit/test_post_mortem_debug.py rename to neutron/tests/unit/tests/test_post_mortem_debug.py diff --git a/setup.cfg b/setup.cfg index 3d6be872bca..e689f10e2d0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -172,8 +172,8 @@ neutron.ml2.type_drivers = neutron.ml2.mechanism_drivers = ovsvapp = neutron.plugins.ml2.drivers.ovsvapp.mech_driver:OVSvAppAgentMechanismDriver opendaylight = neutron.plugins.ml2.drivers.opendaylight.driver:OpenDaylightMechanismDriver - logger = neutron.tests.unit.ml2.drivers.mechanism_logger:LoggerMechanismDriver - test = neutron.tests.unit.ml2.drivers.mechanism_test:TestMechanismDriver + logger = neutron.tests.unit.plugins.ml2.drivers.mechanism_logger:LoggerMechanismDriver + test = neutron.tests.unit.plugins.ml2.drivers.mechanism_test:TestMechanismDriver linuxbridge = neutron.plugins.ml2.drivers.mech_linuxbridge:LinuxbridgeMechanismDriver openvswitch = neutron.plugins.ml2.drivers.mech_openvswitch:OpenvswitchMechanismDriver hyperv = neutron.plugins.ml2.drivers.hyperv.mech_hyperv:HypervMechanismDriver @@ -195,11 +195,11 @@ neutron.ml2.mechanism_drivers = fslsdn = neutron.plugins.ml2.drivers.freescale.mechanism_fslsdn:FslsdnMechanismDriver sriovnicswitch = neutron.plugins.ml2.drivers.mech_sriov.mech_driver:SriovNicSwitchMechanismDriver nuage = neutron.plugins.ml2.drivers.mech_nuage.driver:NuageMechanismDriver - fake_agent = neutron.tests.unit.ml2.drivers.mech_fake_agent:FakeAgentMechanismDriver + fake_agent = neutron.tests.unit.plugins.ml2.drivers.mech_fake_agent:FakeAgentMechanismDriver sdnve = neutron.plugins.ml2.drivers.ibm.mechanism_sdnve:SdnveMechanismDriver neutron.ml2.extension_drivers = - test = neutron.tests.unit.ml2.drivers.ext_test:TestExtensionDriver - testdb = neutron.tests.unit.ml2.drivers.ext_test:TestDBExtensionDriver + test = neutron.tests.unit.plugins.ml2.drivers.ext_test:TestExtensionDriver + testdb = neutron.tests.unit.plugins.ml2.drivers.ext_test:TestDBExtensionDriver port_security = neutron.plugins.ml2.extensions.port_security:PortSecurityExtensionDriver cisco_n1kv_ext = neutron.plugins.ml2.drivers.cisco.n1kv.n1kv_ext_driver:CiscoN1kvExtensionDriver neutron.openstack.common.cache.backends = diff --git a/tools/check_unit_test_structure.sh b/tools/check_unit_test_structure.sh new file mode 100755 index 00000000000..9c250fe615c --- /dev/null +++ b/tools/check_unit_test_structure.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# This script identifies the unit test modules that do not correspond +# directly with a module in the code tree. See TESTING.rst for the +# intended structure. + +neutron_path=$(cd "$(dirname "$0")/.." && pwd) +base_test_path=neutron/tests/unit +test_path=$neutron_path/$base_test_path + +test_files=$(find ${test_path} -iname 'test_*.py') + +ignore_regexes=( + "^plugins.*$" +) + +error_count=0 +ignore_count=0 +total_count=0 +for test_file in ${test_files[@]}; do + relative_path=${test_file#$test_path/} + expected_path=$(dirname $neutron_path/neutron/$relative_path) + test_filename=$(basename "$test_file") + expected_filename=${test_filename#test_} + # Module filename (e.g. foo/bar.py -> foo/test_bar.py) + filename=$expected_path/$expected_filename + # Package dir (e.g. foo/ -> test_foo.py) + package_dir=${filename%.py} + if [ ! -f "$filename" ] && [ ! -d "$package_dir" ]; then + for ignore_regex in ${ignore_regexes[@]}; do + if [[ "$relative_path" =~ $ignore_regex ]]; then + ((ignore_count++)) + continue 2 + fi + done + echo "Unexpected test file: $base_test_path/$relative_path" + ((error_count++)) + fi + ((total_count++)) +done + +if [ "$ignore_count" -ne 0 ]; then + echo "$ignore_count unmatched test modules were ignored" +fi + +if [ "$error_count" -eq 0 ]; then + echo 'Success! All test modules match targets in the code tree.' + exit 0 +else + echo "Failure! $error_count of $total_count test modules do not match targets in the code tree." + exit 1 +fi diff --git a/tools/misc-sanity-checks.sh b/tools/misc-sanity-checks.sh index eeac227ed98..0b18f86e222 100644 --- a/tools/misc-sanity-checks.sh +++ b/tools/misc-sanity-checks.sh @@ -32,7 +32,7 @@ check_opinionated_shell () { # If you cannot avoid the use of bash, please change the EXPECTED var below. OBSERVED=$(grep -E '^([[:space:]]*[^#[:space:]]|#!).*bash' \ tox.ini tools/* | wc -l) - EXPECTED=7 + EXPECTED=8 if [ ${EXPECTED} -ne ${OBSERVED} ]; then echo "Bash usage has been detected!" >>$FAILURES fi diff --git a/tox.ini b/tox.ini index a32fa8c3429..c3bb17f0e4e 100644 --- a/tox.ini +++ b/tox.ini @@ -77,6 +77,7 @@ deps = commands= # If it is easier to add a check via a shell script, consider adding it in this file sh ./tools/misc-sanity-checks.sh + {toxinidir}/tools/check_unit_test_structure.sh # Checks for coding and style guidelines flake8 sh ./tools/coding-checks.sh --pylint '{posargs}'