From: Assaf Muller Date: Fri, 27 Mar 2015 23:31:51 +0000 (-0400) Subject: Stop running L3 functional tests with both OVSDB interfaces X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2c3b0763bade1b9765cd83bbfe9ee6002770b6e0;p=openstack-build%2Fneutron-build.git Stop running L3 functional tests with both OVSDB interfaces Running the L3 functional tests with both OVSDB interfaces doubles the run time and may discourage developers from running them frequently during development. Since the OVSDB interfaces are tested explicitly, I don't think the trade off is worth it here. The L3 functional tests use OVS in a *really* trivial way and won't catch any issues that the explicit tests won't. Added an OVSInterfaceDriverTestCase plug functional test that runs with both OVS interfaces to make it harder to introduce regressions. Related-Bug: #1442272 Change-Id: I387db347fe34f8497069ddf768624bccb9d1de8b --- diff --git a/neutron/tests/functional/agent/linux/test_interface.py b/neutron/tests/functional/agent/linux/test_interface.py new file mode 100644 index 000000000..9fca936d5 --- /dev/null +++ b/neutron/tests/functional/agent/linux/test_interface.py @@ -0,0 +1,58 @@ +# Copyright (c) 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo_config import cfg +import testtools + +from neutron.agent.linux import interface +from neutron.agent.linux import ip_lib +from neutron.common import exceptions +from neutron.common import utils +from neutron.openstack.common import uuidutils +from neutron.tests import base as tests_base +from neutron.tests.common import net_helpers +from neutron.tests.functional.agent.linux import base + + +class OVSInterfaceDriverTestCase(base.BaseOVSLinuxTestCase): + def setUp(self): + super(OVSInterfaceDriverTestCase, self).setUp() + conf = cfg.ConfigOpts() + conf.register_opts(interface.OPTS) + self.interface = interface.OVSInterfaceDriver(conf) + + def test_plug_checks_if_bridge_exists(self): + with testtools.ExpectedException(exceptions.BridgeDoesNotExist): + self.interface.plug(network_id=42, + port_id=71, + device_name='not_a_device', + mac_address='', + bridge='not_a_bridge', + namespace='not_a_namespace') + + def test_plug_succeeds(self): + device_name = tests_base.get_rand_name() + mac_address = utils.get_random_mac('fa:16:3e:00:00:00'.split(':')) + namespace = self._create_namespace() + bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge + + self.assertFalse(bridge.get_port_name_list()) + self.interface.plug(network_id=uuidutils.generate_uuid(), + port_id=uuidutils.generate_uuid(), + device_name=device_name, + mac_address=mac_address, + bridge=bridge.br_name, + namespace=namespace.namespace) + self.assertIn(device_name, bridge.get_port_name_list()) + self.assertTrue(ip_lib.device_exists(device_name, namespace.namespace)) diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py index 62c1ad642..876175d10 100755 --- a/neutron/tests/functional/agent/test_l3_agent.py +++ b/neutron/tests/functional/agent/test_l3_agent.py @@ -60,7 +60,7 @@ def get_ovs_bridge(br_name): return ovs_lib.OVSBridge(br_name) -class L3AgentTestFramework(base.BaseOVSLinuxTestCase): +class L3AgentTestFramework(base.BaseLinuxTestCase): def setUp(self): super(L3AgentTestFramework, self).setUp() mock.patch('neutron.agent.l3.agent.L3PluginApi').start()