From 2cad7198f47acdd52130bcbad08eeef5ed2a627f Mon Sep 17 00:00:00 2001 From: Stanislaw Pitucha Date: Thu, 21 Feb 2013 20:01:48 +0000 Subject: [PATCH] Remove function redefinitions A number of tests have never been run due to another function having the same name. Duplicate names have been changed and additionally pyflakes check will now fail in such situations. Also fix ovs ethernet driver test which was incorrect. Change-Id: Icd93528395e65a24194a6ec5dfb8025a820d29b5 --- nova/tests/baremetal/test_driver.py | 2 +- nova/tests/test_libvirt_vif.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nova/tests/baremetal/test_driver.py b/nova/tests/baremetal/test_driver.py index 8e23908f4..bf0a4740b 100644 --- a/nova/tests/baremetal/test_driver.py +++ b/nova/tests/baremetal/test_driver.py @@ -152,7 +152,7 @@ class BareMetalDriverWithDBTestCase(bm_db_base.BMDBTestCase): self.assertEqual(row['instance_uuid'], node['instance']['uuid']) self.assertEqual(row['instance_name'], node['instance']['hostname']) - def test_macs_for_instance(self): + def test_macs_from_nic_for_instance(self): node = self._create_node() expected = set([nic['address'] for nic in node['nic_info']]) self.assertEqual( diff --git a/nova/tests/test_libvirt_vif.py b/nova/tests/test_libvirt_vif.py index cb7943ea8..df0d951f7 100644 --- a/nova/tests/test_libvirt_vif.py +++ b/nova/tests/test_libvirt_vif.py @@ -409,7 +409,7 @@ class LibvirtVifTestCase(test.TestCase): self.mapping_bridge_quantum, br_want) - def _check_ovs_ethernet_driver(self, d, net, mapping): + def _check_ovs_ethernet_driver(self, d, net, mapping, dev_prefix): self.flags(firewall_driver="nova.virt.firewall.NoopFirewallDriver") xml = self._get_instance_xml(d, net, mapping) @@ -419,22 +419,22 @@ class LibvirtVifTestCase(test.TestCase): node = ret[0] self.assertEqual(node.get("type"), "ethernet") dev_name = node.find("target").get("dev") - self.assertTrue(dev_name.startswith("tap")) + self.assertTrue(dev_name.startswith(dev_prefix)) mac = node.find("mac").get("address") self.assertEqual(mac, self.mapping_ovs['mac']) script = node.find("script").get("path") self.assertEquals(script, "") - def test_ovs_ethernet_driver(self): + def test_ovs_ethernet_driver_legacy(self): def get_connection(): return fakelibvirt.Connection("qemu:///session", False, 9010) d = vif.LibvirtOpenVswitchDriver(get_connection) - d = vif.LibvirtOpenVswitchDriver() self._check_ovs_ethernet_driver(d, self.net_ovs, - self.mapping_ovs_legacy) + self.mapping_ovs_legacy, + "nic") def test_ovs_ethernet_driver(self): def get_connection(): @@ -444,7 +444,8 @@ class LibvirtVifTestCase(test.TestCase): d = vif.LibvirtGenericVIFDriver(get_connection) self._check_ovs_ethernet_driver(d, self.net_ovs, - self.mapping_ovs) + self.mapping_ovs, + "tap") def _check_ovs_virtualport_driver(self, d, net, mapping, want_iface_id): self.flags(firewall_driver="nova.virt.firewall.NoopFirewallDriver")