Fix unit tests for RHEL

Fixes bug 1158609
Fixes bug 1158612

Change-Id: I5ee6214a935cfa663c96b1ba6893f265890c4202
This commit is contained in:
Gary Kotton 2013-04-02 15:52:37 +00:00
parent cf4d1d8c65
commit b15b1effbe
1 changed files with 13 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import mock
from oslo.config import cfg
import testtools
from quantum.agent.linux import ip_lib
from quantum.plugins.linuxbridge.agent import linuxbridge_quantum_agent
from quantum.plugins.linuxbridge.common import constants as lconst
from quantum.tests import base
@ -59,6 +60,14 @@ class TestLinuxBridge(base.BaseTestCase):
class TestLinuxBridgeAgent(base.BaseTestCase):
LINK_SAMPLE = [
'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 \\'
'qdisc mq state UP qlen 1000\ link/ether \\'
'cc:dd:ee:ff:ab:cd brd ff:ff:ff:ff:ff:ff']
def setUp(self):
super(TestLinuxBridgeAgent, self).setUp()
cfg.CONF.set_override('rpc_backend',
@ -68,6 +77,10 @@ class TestLinuxBridgeAgent(base.BaseTestCase):
'LinuxBridgeManager')
self.lbmgr_mock = self.lbmgr_patcher.start()
self.addCleanup(self.lbmgr_patcher.stop)
self.execute_p = mock.patch.object(ip_lib.IPWrapper, '_execute')
self.execute = self.execute_p.start()
self.addCleanup(self.execute_p.stop)
self.execute.return_value = '\n'.join(self.LINK_SAMPLE)
def test_update_devices_failed(self):
lbmgr_instance = self.lbmgr_mock.return_value