Remove excessive usage of mock_the_extension_manager in unit tests - part 2
Also fixes incorrect oneview tests that apparently used to be hidden by that. Similarly, insufficient mocking in the PXE boot interface tests was fixed. Now only test_manager uses mock_the_extension_manager. Change-Id: Iaef9555337919706cd165adbbb2e1be9322f80b7
This commit is contained in:
parent
580d4338e2
commit
a684883d22
@ -411,8 +411,9 @@ def _clean_up_pxe_env(task, images_info):
|
||||
|
||||
class PXEBoot(base.BootInterface):
|
||||
|
||||
capabilities = ['iscsi_volume_boot']
|
||||
|
||||
def __init__(self):
|
||||
self.capabilities = ['iscsi_volume_boot']
|
||||
if CONF.pxe.ipxe_enabled:
|
||||
pxe_utils.create_ipxe_boot_script()
|
||||
|
||||
|
@ -42,6 +42,7 @@ from ironic.common import config as ironic_config
|
||||
from ironic.common import context as ironic_context
|
||||
from ironic.common import driver_factory
|
||||
from ironic.common import hash_ring
|
||||
from ironic.common import utils as common_utils
|
||||
from ironic.conf import CONF
|
||||
from ironic.drivers import base as drivers_base
|
||||
from ironic.objects import base as objects_base
|
||||
@ -155,6 +156,12 @@ class TestCase(oslo_test_base.BaseTestCase):
|
||||
"""Override config options for a test."""
|
||||
self.cfg_fixture.config(**kw)
|
||||
|
||||
def config_temp_dir(self, option, group=None):
|
||||
"""Override a config option with a temporary directory."""
|
||||
temp_dir = tempfile.mkdtemp()
|
||||
self.addCleanup(lambda: common_utils.rmtree_without_raise(temp_dir))
|
||||
self.config(**{option: temp_dir, 'group': group})
|
||||
|
||||
def set_defaults(self, **kw):
|
||||
"""Set default values of config options."""
|
||||
group = kw.pop('group', None)
|
||||
|
@ -24,7 +24,6 @@ from ironic.drivers.modules.ansible import deploy as ansible_deploy
|
||||
from ironic.drivers.modules import deploy_utils
|
||||
from ironic.drivers.modules import fake
|
||||
from ironic.drivers.modules import pxe
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.objects import utils as object_utils
|
||||
|
||||
@ -56,11 +55,10 @@ class AnsibleDeployTestCaseBase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(AnsibleDeployTestCaseBase, self).setUp()
|
||||
|
||||
self.config(enabled_deploy_interfaces='ansible',
|
||||
self.config(enabled_hardware_types='manual-management',
|
||||
enabled_deploy_interfaces='ansible',
|
||||
enabled_power_interfaces='fake',
|
||||
enabled_management_interfaces='fake')
|
||||
mgr_utils.mock_the_extension_manager(driver='manual-management',
|
||||
namespace='ironic.hardware.types')
|
||||
node = {
|
||||
'driver': 'manual-management',
|
||||
'instance_info': INSTANCE_INFO,
|
||||
|
@ -38,7 +38,6 @@ from ironic.drivers.modules.ilo import management as ilo_management
|
||||
from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules.storage import noop as noop_storage
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -56,7 +55,7 @@ class IloBootCommonMethodsTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(IloBootCommonMethodsTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
|
||||
self.config(enabled_drivers=['iscsi_ilo'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='iscsi_ilo', driver_info=INFO_DICT)
|
||||
|
||||
@ -76,7 +75,7 @@ class IloBootPrivateMethodsTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(IloBootPrivateMethodsTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
|
||||
self.config(enabled_drivers=['iscsi_ilo'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='iscsi_ilo', driver_info=INFO_DICT)
|
||||
|
||||
@ -1130,7 +1129,7 @@ class IloPXEBootTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(IloPXEBootTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="pxe_ilo")
|
||||
self.config(enabled_drivers=['pxe_ilo'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='pxe_ilo', driver_info=INFO_DICT)
|
||||
|
||||
|
@ -35,7 +35,6 @@ from ironic.conductor import task_manager
|
||||
from ironic.conductor import utils as manager_utils
|
||||
from ironic.drivers.modules import deploy_utils
|
||||
from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -214,7 +213,7 @@ class IloCommonMethodsTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(IloCommonMethodsTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ilo")
|
||||
self.config(enabled_drivers=['fake_ilo'])
|
||||
self.info = db_utils.get_test_ilo_info()
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='fake_ilo', driver_info=self.info)
|
||||
|
@ -22,7 +22,6 @@ from ironic.common import exception
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.drivers.modules import ipmitool
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -39,7 +38,7 @@ class IloConsoleInterfaceTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(IloConsoleInterfaceTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
|
||||
self.config(enabled_drivers=['iscsi_ilo'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='iscsi_ilo', driver_info=INFO_DICT)
|
||||
|
||||
|
@ -27,7 +27,6 @@ from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.drivers.modules.ilo import inspect as ilo_inspect
|
||||
from ironic.drivers.modules.ilo import power as ilo_power
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -40,7 +39,7 @@ class IloInspectTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(IloInspectTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ilo")
|
||||
self.config(enabled_drivers=['fake_ilo'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='fake_ilo', driver_info=INFO_DICT)
|
||||
|
||||
@ -270,7 +269,7 @@ class TestInspectPrivateMethods(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestInspectPrivateMethods, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ilo")
|
||||
self.config(enabled_drivers=['fake_ilo'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='fake_ilo', driver_info=INFO_DICT)
|
||||
|
||||
|
@ -27,7 +27,6 @@ from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.drivers.modules.ilo import management as ilo_management
|
||||
from ironic.drivers.modules import ipmitool
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -41,7 +40,7 @@ class IloManagementTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(IloManagementTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ilo")
|
||||
self.config(enabled_drivers=['fake_ilo'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='fake_ilo', driver_info=INFO_DICT)
|
||||
|
||||
|
@ -27,7 +27,6 @@ from ironic.conductor import task_manager
|
||||
from ironic.conductor import utils as manager_utils
|
||||
from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.drivers.modules.ilo import power as ilo_power
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -44,7 +43,7 @@ class IloPowerInternalMethodsTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(IloPowerInternalMethodsTestCase, self).setUp()
|
||||
driver_info = INFO_DICT
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ilo")
|
||||
self.config(enabled_drivers=['fake_ilo'])
|
||||
self.node = db_utils.create_test_node(
|
||||
driver='fake_ilo',
|
||||
driver_info=driver_info,
|
||||
@ -169,7 +168,7 @@ class IloPowerTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(IloPowerTestCase, self).setUp()
|
||||
driver_info = INFO_DICT
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_ilo")
|
||||
self.config(enabled_drivers=['fake_ilo'])
|
||||
self.node = obj_utils.create_test_node(self.context,
|
||||
driver='fake_ilo',
|
||||
driver_info=driver_info)
|
||||
|
@ -24,7 +24,6 @@ from ironic.conductor import utils as manager_utils
|
||||
from ironic.drivers.modules import deploy_utils
|
||||
from ironic.drivers.modules.ilo import common as ilo_common
|
||||
from ironic.drivers.modules.ilo import vendor as ilo_vendor
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -37,7 +36,7 @@ class VendorPassthruTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VendorPassthruTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
|
||||
self.config(enabled_drivers=['iscsi_ilo'])
|
||||
self.node = obj_utils.create_test_node(self.context,
|
||||
driver='iscsi_ilo',
|
||||
driver_info=INFO_DICT)
|
||||
|
@ -19,7 +19,6 @@ from oslo_utils import importutils
|
||||
from ironic.common import exception
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.oneview import common
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -41,7 +40,7 @@ class OneViewCommonTestCase(db_base.DbTestCase):
|
||||
self.config(password='password', group='oneview')
|
||||
self.config(tls_cacert_file='ca_file', group='oneview')
|
||||
self.config(allow_insecure_connections=False, group='oneview')
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_oneview")
|
||||
self.config(enabled_drivers=['fake_oneview'])
|
||||
|
||||
def test_prepare_manager_url(self):
|
||||
self.assertEqual(
|
||||
|
@ -25,7 +25,6 @@ from ironic.drivers.modules import iscsi_deploy
|
||||
from ironic.drivers.modules.oneview import common
|
||||
from ironic.drivers.modules.oneview import deploy
|
||||
from ironic.drivers.modules.oneview import deploy_utils
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -92,7 +91,7 @@ class OneViewPeriodicTasks(db_base.DbTestCase):
|
||||
self.config(username='user', group='oneview')
|
||||
self.config(password='password', group='oneview')
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_oneview')
|
||||
self.config(enabled_drivers=['fake_oneview'])
|
||||
self.driver = driver_factory.get_driver('fake_oneview')
|
||||
self.deploy = OneViewDriverDeploy()
|
||||
self.os_primary = mock.MagicMock(spec=METHODS)
|
||||
@ -247,7 +246,7 @@ class OneViewIscsiDeployTestCase(db_base.DbTestCase):
|
||||
self.config(username='user', group='oneview')
|
||||
self.config(password='password', group='oneview')
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='iscsi_pxe_oneview')
|
||||
self.config(enabled_drivers=['iscsi_pxe_oneview'])
|
||||
self.driver = driver_factory.get_driver('iscsi_pxe_oneview')
|
||||
|
||||
OV_DRV_INFO_DICT = db_utils.get_test_oneview_driver_info()
|
||||
@ -374,7 +373,7 @@ class OneViewAgentDeployTestCase(db_base.DbTestCase):
|
||||
self.config(username='user', group='oneview')
|
||||
self.config(password='password', group='oneview')
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='agent_pxe_oneview')
|
||||
self.config(enabled_drivers=['agent_pxe_oneview'])
|
||||
self.driver = driver_factory.get_driver('agent_pxe_oneview')
|
||||
|
||||
OV_DRV_INFO_DICT = db_utils.get_test_oneview_driver_info()
|
||||
|
@ -23,7 +23,6 @@ from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.oneview import common
|
||||
from ironic.drivers.modules.oneview import deploy_utils
|
||||
from ironic import objects
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -39,8 +38,7 @@ class OneViewDeployUtilsTestCase(db_base.DbTestCase):
|
||||
self.config(manager_url='https://1.2.3.4', group='oneview')
|
||||
self.config(username='user', group='oneview')
|
||||
self.config(password='password', group='oneview')
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_oneview')
|
||||
self.config(enabled_drivers=['fake_oneview'])
|
||||
self.driver = driver_factory.get_driver('fake_oneview')
|
||||
|
||||
self.node = obj_utils.create_test_node(
|
||||
|
@ -18,7 +18,6 @@ import mock
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.oneview import common as ov_common
|
||||
from ironic.drivers.modules.oneview import deploy_utils
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -30,7 +29,7 @@ class AgentPXEOneViewInspectTestCase(db_base.DbTestCase):
|
||||
super(AgentPXEOneViewInspectTestCase, self).setUp()
|
||||
self.config(enabled=True, group='inspector')
|
||||
self.config(manager_url='https://1.2.3.4', group='oneview')
|
||||
mgr_utils.mock_the_extension_manager(driver="agent_pxe_oneview")
|
||||
self.config(enabled_drivers=['agent_pxe_oneview'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='agent_pxe_oneview',
|
||||
properties=db_utils.get_test_oneview_properties(),
|
||||
@ -46,7 +45,6 @@ class AgentPXEOneViewInspectTestCase(db_base.DbTestCase):
|
||||
@mock.patch.object(ov_common, 'validate_oneview_resources_compatibility',
|
||||
autospect=True)
|
||||
def test_validate(self, mock_validate):
|
||||
self.config(enabled=False, group='inspector')
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=False) as task:
|
||||
task.driver.inspect.validate(task)
|
||||
@ -67,7 +65,7 @@ class ISCSIPXEOneViewInspectTestCase(db_base.DbTestCase):
|
||||
super(ISCSIPXEOneViewInspectTestCase, self).setUp()
|
||||
self.config(enabled=True, group='inspector')
|
||||
self.config(manager_url='https://1.2.3.4', group='oneview')
|
||||
mgr_utils.mock_the_extension_manager(driver="iscsi_pxe_oneview")
|
||||
self.config(enabled_drivers=['iscsi_pxe_oneview'])
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='iscsi_pxe_oneview',
|
||||
properties=db_utils.get_test_oneview_properties(),
|
||||
@ -83,7 +81,6 @@ class ISCSIPXEOneViewInspectTestCase(db_base.DbTestCase):
|
||||
@mock.patch.object(ov_common, 'validate_oneview_resources_compatibility',
|
||||
autospect=True)
|
||||
def test_validate(self, mock_validate):
|
||||
self.config(enabled=False, group='inspector')
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=False) as task:
|
||||
task.driver.inspect.validate(task)
|
||||
|
@ -24,7 +24,6 @@ from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.oneview import common
|
||||
from ironic.drivers.modules.oneview import deploy_utils
|
||||
from ironic.drivers.modules.oneview import management
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -40,8 +39,7 @@ class OneViewManagementDriverFunctionsTestCase(db_base.DbTestCase):
|
||||
self.config(manager_url='https://1.2.3.4', group='oneview')
|
||||
self.config(username='user', group='oneview')
|
||||
self.config(password='password', group='oneview')
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_oneview")
|
||||
self.config(enabled_drivers=['fake_oneview'])
|
||||
self.driver = driver_factory.get_driver("fake_oneview")
|
||||
|
||||
self.node = obj_utils.create_test_node(
|
||||
@ -224,7 +222,7 @@ class OneViewManagementDriverTestCase(db_base.DbTestCase):
|
||||
self.config(tls_cacert_file='ca_file', group='oneview')
|
||||
self.config(allow_insecure_connections=False, group='oneview')
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_oneview")
|
||||
self.config(enabled_drivers=['fake_oneview'])
|
||||
self.driver = driver_factory.get_driver("fake_oneview")
|
||||
|
||||
self.node = obj_utils.create_test_node(
|
||||
|
@ -25,7 +25,6 @@ from ironic.drivers.modules.oneview import common
|
||||
from ironic.drivers.modules.oneview import deploy_utils
|
||||
from ironic.drivers.modules.oneview import management
|
||||
from ironic.drivers.modules.oneview import power
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -42,8 +41,7 @@ class OneViewPowerDriverTestCase(db_base.DbTestCase):
|
||||
self.config(password='password', group='oneview')
|
||||
self.config(tls_cacert_file='ca_file', group='oneview')
|
||||
self.config(allow_insecure_connections=False, group='oneview')
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_oneview')
|
||||
self.config(enabled_drivers=['fake_oneview'])
|
||||
self.driver = driver_factory.get_driver('fake_oneview')
|
||||
|
||||
self.node = obj_utils.create_test_node(
|
||||
|
@ -42,7 +42,6 @@ from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules.storage import cinder
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -1066,7 +1065,7 @@ class OtherFunctionTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(OtherFunctionTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
self.config(enabled_drivers=['fake_pxe'])
|
||||
self.node = obj_utils.create_test_node(self.context, driver='fake_pxe')
|
||||
|
||||
def test_get_dev(self):
|
||||
@ -1259,7 +1258,7 @@ class VirtualMediaDeployUtilsTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(VirtualMediaDeployUtilsTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
|
||||
self.config(enabled_drivers=['iscsi_ilo'])
|
||||
info_dict = db_utils.get_test_ilo_info()
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context, driver='iscsi_ilo', driver_info=info_dict)
|
||||
@ -1441,7 +1440,6 @@ class TrySetBootDeviceTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TrySetBootDeviceTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake")
|
||||
self.node = obj_utils.create_test_node(self.context, driver="fake")
|
||||
|
||||
@mock.patch.object(manager_utils, 'node_set_boot_device', autospec=True)
|
||||
@ -1498,7 +1496,7 @@ class AgentMethodsTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(AgentMethodsTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_agent')
|
||||
self.config(enabled_drivers=['fake_agent'])
|
||||
|
||||
self.clean_steps = {
|
||||
'deploy': [
|
||||
@ -2204,7 +2202,7 @@ class TestBuildInstanceInfoForDeploy(db_base.DbTestCase):
|
||||
return_value=image_info)
|
||||
glance_mock.return_value.swift_temp_url.return_value = (
|
||||
'http://temp-url')
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_agent')
|
||||
self.config(enabled_drivers=['fake_agent'])
|
||||
with task_manager.acquire(
|
||||
self.context, self.node.uuid, shared=False) as task:
|
||||
|
||||
@ -2266,7 +2264,7 @@ class TestBuildInstanceInfoForDeploy(db_base.DbTestCase):
|
||||
'image_checksum': 'aa',
|
||||
'image_container_format': 'bare',
|
||||
'image_disk_format': 'qcow2'}
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_agent')
|
||||
self.config(enabled_drivers=['fake_agent'])
|
||||
with task_manager.acquire(
|
||||
self.context, self.node.uuid, shared=False) as task:
|
||||
|
||||
@ -2302,7 +2300,7 @@ class TestBuildInstanceInfoForDeploy(db_base.DbTestCase):
|
||||
self.node.driver_internal_info = driver_internal_info
|
||||
self.node.save()
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_agent')
|
||||
self.config(enabled_drivers=['fake_agent'])
|
||||
with task_manager.acquire(
|
||||
self.context, self.node.uuid, shared=False) as task:
|
||||
|
||||
@ -2331,7 +2329,7 @@ class TestBuildInstanceInfoForDeploy(db_base.DbTestCase):
|
||||
self.node.driver_internal_info = driver_internal_info
|
||||
self.node.save()
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_agent')
|
||||
self.config(enabled_drivers=['fake_agent'])
|
||||
validate_href_mock.side_effect = ['http://image-ref',
|
||||
'http://kernel-ref',
|
||||
'http://ramdisk-ref']
|
||||
@ -2370,7 +2368,7 @@ class TestBuildInstanceInfoForDeploy(db_base.DbTestCase):
|
||||
self.node.instance_info = i_info
|
||||
self.node.save()
|
||||
|
||||
mgr_utils.mock_the_extension_manager(driver='fake_agent')
|
||||
self.config(enabled_drivers=['fake_agent'])
|
||||
with task_manager.acquire(
|
||||
self.context, self.node.uuid, shared=False) as task:
|
||||
|
||||
|
@ -40,7 +40,6 @@ from ironic.drivers.modules.network import flat as flat_network
|
||||
from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules.storage import noop as noop_storage
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -62,7 +61,7 @@ class IscsiDeployPrivateMethodsTestCase(db_base.DbTestCase):
|
||||
'driver_info': DRV_INFO_DICT,
|
||||
'driver_internal_info': DRV_INTERNAL_INFO_DICT,
|
||||
}
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
self.config(enabled_drivers=['fake_pxe'])
|
||||
self.node = obj_utils.create_test_node(self.context, **n)
|
||||
|
||||
def test__save_disk_layout(self):
|
||||
@ -104,7 +103,7 @@ class IscsiDeployMethodsTestCase(db_base.DbTestCase):
|
||||
'driver_info': DRV_INFO_DICT,
|
||||
'driver_internal_info': DRV_INTERNAL_INFO_DICT,
|
||||
}
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
self.config(enabled_drivers=['fake_pxe'])
|
||||
self.node = obj_utils.create_test_node(self.context, **n)
|
||||
|
||||
@mock.patch.object(disk_utils, 'get_image_mb', autospec=True)
|
||||
@ -546,7 +545,7 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ISCSIDeployTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
self.config(enabled_drivers=['fake_pxe'])
|
||||
self.driver = driver_factory.get_driver("fake_pxe")
|
||||
# NOTE(TheJulia): We explicitly set the noop storage interface as the
|
||||
# default below for deployment tests in order to raise any change
|
||||
@ -933,7 +932,7 @@ class CleanUpFullFlowTestCase(db_base.DbTestCase):
|
||||
self.config(image_cache_size=0, group='pxe')
|
||||
|
||||
# Configure node
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
self.config(enabled_drivers=['fake_pxe'])
|
||||
instance_info = INST_INFO_DICT
|
||||
instance_info['deploy_key'] = 'fake-56789'
|
||||
self.node = obj_utils.create_test_node(
|
||||
|
@ -39,7 +39,6 @@ from ironic.drivers.modules import agent_base_vendor
|
||||
from ironic.drivers.modules import deploy_utils
|
||||
from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules.storage import noop as noop_storage
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -51,6 +50,7 @@ DRV_INFO_DICT = db_utils.get_test_pxe_driver_info()
|
||||
DRV_INTERNAL_INFO_DICT = db_utils.get_test_pxe_driver_internal_info()
|
||||
|
||||
|
||||
@mock.patch.object(pxe.PXEBoot, '__init__', lambda self: None)
|
||||
class PXEPrivateMethodsTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
@ -61,7 +61,8 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
|
||||
'driver_info': DRV_INFO_DICT,
|
||||
'driver_internal_info': DRV_INTERNAL_INFO_DICT,
|
||||
}
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
self.config(enabled_drivers=['fake_pxe'])
|
||||
self.config_temp_dir('http_root', group='deploy')
|
||||
self.node = obj_utils.create_test_node(self.context, **n)
|
||||
|
||||
def _test__parse_driver_info_missing_kernel(self, mode='deploy'):
|
||||
@ -711,7 +712,7 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
|
||||
class CleanUpPxeEnvTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(CleanUpPxeEnvTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager(driver="fake_pxe")
|
||||
self.config(enabled_drivers=['fake_pxe'])
|
||||
instance_info = INST_INFO_DICT
|
||||
instance_info['deploy_key'] = 'fake-56789'
|
||||
self.node = obj_utils.create_test_node(
|
||||
@ -732,6 +733,7 @@ class CleanUpPxeEnvTestCase(db_base.DbTestCase):
|
||||
mock_cache.return_value.clean_up.assert_called_once_with()
|
||||
|
||||
|
||||
@mock.patch.object(pxe.PXEBoot, '__init__', lambda self: None)
|
||||
class PXEBootTestCase(db_base.DbTestCase):
|
||||
|
||||
driver = 'fake_pxe'
|
||||
@ -739,11 +741,10 @@ class PXEBootTestCase(db_base.DbTestCase):
|
||||
def setUp(self):
|
||||
super(PXEBootTestCase, self).setUp()
|
||||
self.context.auth_token = 'fake'
|
||||
self.temp_dir = tempfile.mkdtemp()
|
||||
self.config(tftp_root=self.temp_dir, group='pxe')
|
||||
self.temp_dir = tempfile.mkdtemp()
|
||||
self.config(images_path=self.temp_dir, group='pxe')
|
||||
mgr_utils.mock_the_extension_manager(driver=self.driver)
|
||||
self.config_temp_dir('tftp_root', group='pxe')
|
||||
self.config_temp_dir('images_path', group='pxe')
|
||||
self.config_temp_dir('http_root', group='deploy')
|
||||
self.config(enabled_drivers=[self.driver])
|
||||
instance_info = INST_INFO_DICT
|
||||
instance_info['deploy_key'] = 'fake-56789'
|
||||
self.node = obj_utils.create_test_node(
|
||||
|
@ -24,7 +24,6 @@ from ironic.common import exception
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.xclarity import common
|
||||
from ironic.drivers.modules.xclarity import management
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -43,8 +42,6 @@ class XClarityManagementDriverTestCase(db_base.DbTestCase):
|
||||
self.config(enabled_hardware_types=['xclarity'],
|
||||
enabled_power_interfaces=['xclarity'],
|
||||
enabled_management_interfaces=['xclarity'])
|
||||
mgr_utils.mock_the_extension_manager(
|
||||
driver='xclarity', namespace='ironic.hardware.types')
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context,
|
||||
driver='xclarity',
|
||||
|
@ -24,7 +24,6 @@ from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers.modules.xclarity import common
|
||||
from ironic.drivers.modules.xclarity import power
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
@ -48,8 +47,6 @@ class XClarityPowerDriverTestCase(db_base.DbTestCase):
|
||||
self.config(enabled_hardware_types=['xclarity'],
|
||||
enabled_power_interfaces=['xclarity'],
|
||||
enabled_management_interfaces=['xclarity'])
|
||||
mgr_utils.mock_the_extension_manager(
|
||||
driver='xclarity', namespace='ironic.hardware.types')
|
||||
self.node = obj_utils.create_test_node(
|
||||
self.context,
|
||||
driver='xclarity',
|
||||
|
@ -25,7 +25,6 @@ from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base as driver_base
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
@ -34,7 +33,6 @@ class FakeDriverTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(FakeDriverTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager()
|
||||
self.driver = driver_factory.get_driver("fake")
|
||||
self.node = obj_utils.get_test_node(self.context)
|
||||
self.task = mock.MagicMock(spec=task_manager.TaskManager)
|
||||
|
@ -29,7 +29,6 @@ from ironic.drivers.modules import agent_client
|
||||
from ironic.drivers.modules import fake
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.tests import base as tests_base
|
||||
from ironic.tests.unit.conductor import mgr_utils
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.objects import utils as obj_utils
|
||||
|
||||
@ -38,7 +37,6 @@ class UtilsTestCase(db_base.DbTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(UtilsTestCase, self).setUp()
|
||||
mgr_utils.mock_the_extension_manager()
|
||||
self.driver = driver_factory.get_driver("fake")
|
||||
self.node = obj_utils.create_test_node(self.context)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user