Register root_helper in test_debug_commands and test_dhcp_agent

root_helper variable currently must be introduced with a call
to register_root_helper, not with a simple assignment.

Change-Id: I3e72379925a994acfb6defb24820ab63eab43957
Fixes: bug #1117240
This commit is contained in:
Alessio Ababilov 2013-02-06 13:22:53 +02:00
parent 7d033377db
commit 48a2feb2f7
2 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import socket
import mock import mock
import unittest2 as unittest import unittest2 as unittest
from quantum.agent.common import config
from quantum.agent.linux import interface from quantum.agent.linux import interface
from quantum.debug import commands from quantum.debug import commands
from quantum.debug.debug_agent import DEVICE_OWNER_PROBE, QuantumDebugAgent from quantum.debug.debug_agent import DEVICE_OWNER_PROBE, QuantumDebugAgent
@ -37,7 +38,7 @@ class TestDebugCommands(unittest.TestCase):
cfg.CONF.register_opts(QuantumDebugAgent.OPTS) cfg.CONF.register_opts(QuantumDebugAgent.OPTS)
cfg.CONF(args=[], project='quantum') cfg.CONF(args=[], project='quantum')
cfg.CONF.set_override('use_namespaces', True) cfg.CONF.set_override('use_namespaces', True)
cfg.CONF.root_helper = 'sudo' config.register_root_helper(cfg.CONF)
self.addCleanup(mock.patch.stopall) self.addCleanup(mock.patch.stopall)
device_exists_p = mock.patch( device_exists_p = mock.patch(

View File

@ -23,6 +23,7 @@ import uuid
import mock import mock
import unittest2 as unittest import unittest2 as unittest
from quantum.agent.common import config
from quantum.agent import dhcp_agent from quantum.agent import dhcp_agent
from quantum.agent.linux import interface from quantum.agent.linux import interface
from quantum.common import exceptions from quantum.common import exceptions
@ -254,7 +255,7 @@ class TestDhcpAgentEventHandler(unittest.TestCase):
cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS) cfg.CONF.register_opts(dhcp_agent.DeviceManager.OPTS)
cfg.CONF.set_override('interface_driver', cfg.CONF.set_override('interface_driver',
'quantum.agent.linux.interface.NullDriver') 'quantum.agent.linux.interface.NullDriver')
cfg.CONF.root_helper = 'sudo' config.register_root_helper(cfg.CONF)
cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS) cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
self.notification_p = mock.patch( self.notification_p = mock.patch(
'quantum.agent.rpc.NotificationDispatcher') 'quantum.agent.rpc.NotificationDispatcher')
@ -666,7 +667,7 @@ class TestDeviceManager(unittest.TestCase):
cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS) cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
cfg.CONF.set_override('interface_driver', cfg.CONF.set_override('interface_driver',
'quantum.agent.linux.interface.NullDriver') 'quantum.agent.linux.interface.NullDriver')
cfg.CONF.root_helper = 'sudo' config.register_root_helper(cfg.CONF)
self.device_exists_p = mock.patch( self.device_exists_p = mock.patch(
'quantum.agent.linux.ip_lib.device_exists') 'quantum.agent.linux.ip_lib.device_exists')