Ensure unit tests work with all interface types

Fixes bug 1167520

Change-Id: I42ed3a5718d771924caffba3f58340e7f1d2e2ad
This commit is contained in:
Gary Kotton 2013-04-10 19:15:12 +00:00
parent 4eab424be3
commit 91bed75c6a
3 changed files with 9 additions and 3 deletions

View File

@ -64,7 +64,7 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
'1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue \\'
'state UNKNOWN \\'
'link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00',
'2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 \\'
'2: eth77: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 \\'
'qdisc mq state UP qlen 1000\ link/ether \\'
'cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff']
@ -81,6 +81,11 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
self.execute = self.execute_p.start()
self.addCleanup(self.execute_p.stop)
self.execute.return_value = '\n'.join(self.LINK_SAMPLE)
self.get_mac_p = mock.patch('quantum.agent.linux.utils.'
'get_interface_mac')
self.get_mac = self.get_mac_p.start()
self.addCleanup(self.get_mac_p.stop)
self.get_mac.return_value = '00:00:00:00:00:01'
def test_update_devices_failed(self):
lbmgr_instance = self.lbmgr_mock.return_value

View File

@ -58,7 +58,7 @@ class TestOvsQuantumAgent(base.BaseTestCase):
'OVSQuantumAgent.setup_integration_br',
return_value=mock.Mock()):
with mock.patch('quantum.agent.linux.utils.get_interface_mac',
return_value='000000000001'):
return_value='00:00:00:00:00:01'):
self.agent = ovs_quantum_agent.OVSQuantumAgent(**kwargs)
self.agent.sg_agent = mock.Mock()

View File

@ -124,7 +124,8 @@ class TunnelTest(base.BaseTestCase):
'phy-tunnel_bridge_mapping').AndReturn([self.inta, self.intb])
self.mox.StubOutWithMock(utils, 'get_interface_mac')
utils.get_interface_mac(self.INT_BRIDGE).AndReturn('000000000001')
utils.get_interface_mac(self.INT_BRIDGE).AndReturn(
'00:00:00:00:00:01')
def testConstruct(self):
self.mox.ReplayAll()