diff options
author | Kaifeng Wang <kaifeng.w@gmail.com> | 2017-10-18 16:04:42 +0800 |
---|---|---|
committer | Kaifeng Wang <kaifeng.w@gmail.com> | 2018-05-30 21:04:37 +0800 |
commit | bce7f11785bc7c98c05ebf8658bd4de597ed3c05 (patch) | |
tree | 807373731ac5a02033f7824ca75afc119c966204 /ironic/tests/unit/drivers/modules/test_inspector.py | |
parent | 30b494ad467776fccafd00e25da597d513147fb5 (diff) | |
download | ironic-bce7f11785bc7c98c05ebf8658bd4de597ed3c05.tar.gz |
Implements baremetal inspect abort
This patch implements the feature of baremetal inspect abort.
For a node in inspect wait state, an abort request initiates the process of
introspection abort.
Adds transision from ``inspect wait`` to ``inspect failed`` with event
``abort`` to the state machine.
Adds an ``abort`` interface to ``InspectInterface``, which raises
UnsupportedDriverExtension by default.
Implements the ``abort`` interface for ironic inspector inspect interface.
API microversion is bumped for backwards compatibility.
Closes-Bug: #10602
Story: #1703089
Task: #10602
Change-Id: I02a39ed08c7c64b36c6ef05678f0af6d8324c5e2
Diffstat (limited to 'ironic/tests/unit/drivers/modules/test_inspector.py')
-rw-r--r-- | ironic/tests/unit/drivers/modules/test_inspector.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ironic/tests/unit/drivers/modules/test_inspector.py b/ironic/tests/unit/drivers/modules/test_inspector.py index 17d1f301f..4b9fdf0e3 100644 --- a/ironic/tests/unit/drivers/modules/test_inspector.py +++ b/ironic/tests/unit/drivers/modules/test_inspector.py @@ -66,7 +66,7 @@ class GetClientTestCase(db_base.DbTestCase): super(GetClientTestCase, self).setUp() # NOTE(pas-ha) force-reset global inspector session object inspector._INSPECTOR_SESSION = None - self.api_version = (1, 0) + self.api_version = (1, 3) self.context = context.RequestContext(global_request_id='global') def test__get_client(self, mock_init, mock_session, mock_auth, @@ -216,3 +216,17 @@ class CheckStatusTestCase(BaseTestCase): mock_get.assert_called_once_with(self.node.uuid) self.task.process_event.assert_called_once_with('fail') self.assertIn('boom', self.node.last_error) + + +@mock.patch('ironic.drivers.modules.inspector._get_client', autospec=True) +class InspectHardwareAbortTestCase(BaseTestCase): + def test_abort_ok(self, mock_client): + mock_abort = mock_client.return_value.abort + self.driver.inspect.abort(self.task) + mock_abort.assert_called_once_with(self.node.uuid) + + def test_abort_error(self, mock_client): + mock_abort = mock_client.return_value.abort + mock_abort.side_effect = RuntimeError('boom') + self.assertRaises(RuntimeError, self.driver.inspect.abort, self.task) + mock_abort.assert_called_once_with(self.node.uuid) |