summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules/test_agent_base_vendor.py
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@redhat.com>2015-10-16 16:24:39 +0200
committerDmitry Tantsur <dtantsur@redhat.com>2015-11-25 18:03:43 +0100
commit3a7899403a0bdfd34988aca4975474b2cd362cea (patch)
treeca78783a558916709771f79dc0e80df1a84dbdfd /ironic/tests/unit/drivers/modules/test_agent_base_vendor.py
parent9e98c9c46a1ed3f99b5b8be3c9737f0f773f3f90 (diff)
downloadironic-3a7899403a0bdfd34988aca4975474b2cd362cea.tar.gz
Move common code from ironic.conductor.manager to ironic.conductor.utils
This is the first patch in a chain of refactoring patches in preparation for moving to Futurist library. See blueprint futurist for details. Moving *_error_handler from manager.py to utils.py as they're used in many places, including outside of conductor. Also moving set_node_cleaning_step. This should simplify defining public API for 3rdparty drivers later on. Change-Id: I2de8f45a813f1a54f97d1ef763288c81cb37e9e8
Diffstat (limited to 'ironic/tests/unit/drivers/modules/test_agent_base_vendor.py')
-rw-r--r--ironic/tests/unit/drivers/modules/test_agent_base_vendor.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/ironic/tests/unit/drivers/modules/test_agent_base_vendor.py b/ironic/tests/unit/drivers/modules/test_agent_base_vendor.py
index 346efce64..831e871b1 100644
--- a/ironic/tests/unit/drivers/modules/test_agent_base_vendor.py
+++ b/ironic/tests/unit/drivers/modules/test_agent_base_vendor.py
@@ -23,7 +23,6 @@ import mock
from ironic.common import boot_devices
from ironic.common import exception
from ironic.common import states
-from ironic.conductor import manager
from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils
from ironic.drivers.modules import agent_base_vendor
@@ -358,7 +357,7 @@ class TestBaseAgentVendor(db_base.DbTestCase):
'is done. exception: LlamaException')
@mock.patch.object(objects.node.Node, 'touch_provisioning', autospec=True)
- @mock.patch.object(manager, 'set_node_cleaning_steps', autospec=True)
+ @mock.patch.object(manager_utils, 'set_node_cleaning_steps', autospec=True)
@mock.patch.object(agent_base_vendor.BaseAgentVendor,
'notify_conductor_resume_clean', autospec=True)
def test_heartbeat_resume_clean(self, mock_notify, mock_set_steps,
@@ -408,7 +407,7 @@ class TestBaseAgentVendor(db_base.DbTestCase):
mock_touch.reset_mock()
mock_continue.reset_mock()
- @mock.patch('ironic.conductor.manager.cleaning_error_handler')
+ @mock.patch.object(manager_utils, 'cleaning_error_handler')
@mock.patch.object(agent_base_vendor.BaseAgentVendor,
'continue_cleaning', autospec=True)
def test_heartbeat_continue_cleaning_fails(self, mock_continue,
@@ -777,7 +776,7 @@ class TestBaseAgentVendor(db_base.DbTestCase):
'notify_conductor_resume_clean', autospec=True)
@mock.patch.object(agent_base_vendor,
'_get_post_clean_step_hook', autospec=True)
- @mock.patch.object(manager, 'cleaning_error_handler', autospec=True)
+ @mock.patch.object(manager_utils, 'cleaning_error_handler', autospec=True)
@mock.patch.object(agent_client.AgentClient, 'get_commands_status',
autospec=True)
def test_continue_cleaning_with_hook_fails(
@@ -851,8 +850,7 @@ class TestBaseAgentVendor(db_base.DbTestCase):
self.passthru.continue_cleaning(task)
self.assertFalse(notify_mock.called)
- @mock.patch('ironic.conductor.manager.cleaning_error_handler',
- autospec=True)
+ @mock.patch.object(manager_utils, 'cleaning_error_handler', autospec=True)
@mock.patch.object(agent_client.AgentClient, 'get_commands_status',
autospec=True)
def test_continue_cleaning_fail(self, status_mock, error_mock):
@@ -867,8 +865,7 @@ class TestBaseAgentVendor(db_base.DbTestCase):
self.passthru.continue_cleaning(task)
error_mock.assert_called_once_with(task, mock.ANY)
- @mock.patch('ironic.conductor.manager.set_node_cleaning_steps',
- autospec=True)
+ @mock.patch.object(manager_utils, 'set_node_cleaning_steps', autospec=True)
@mock.patch.object(agent_base_vendor.BaseAgentVendor,
'notify_conductor_resume_clean', autospec=True)
@mock.patch.object(agent_client.AgentClient, 'get_commands_status',
@@ -887,8 +884,7 @@ class TestBaseAgentVendor(db_base.DbTestCase):
steps_mock.assert_called_once_with(task)
notify_mock.assert_called_once_with(mock.ANY, task)
- @mock.patch('ironic.conductor.manager.cleaning_error_handler',
- autospec=True)
+ @mock.patch.object(manager_utils, 'cleaning_error_handler', autospec=True)
@mock.patch.object(agent_client.AgentClient, 'get_commands_status',
autospec=True)
def test_continue_cleaning_unknown(self, status_mock, error_mock):