"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/tests/unit/drivers/modules/ilo/test_management.py" between
ironic-16.0.2.tar.gz and ironic-16.0.3.tar.gz

About: OpenStack Ironic (Optional Service: Bare-Metal Provisioning) aims to provision bare metal machines instead of virtual machines, forked from the Nova baremetal driver.
The "Victoria" series (latest release).

test_management.py  (ironic-16.0.2):test_management.py  (ironic-16.0.3)
skipping to change at line 1670 skipping to change at line 1670
task, erase_pattern={'xyz': 'block'}) task, erase_pattern={'xyz': 'block'})
def test_erase_devices_hdd_with_invalid_erase_pattern( def test_erase_devices_hdd_with_invalid_erase_pattern(
self): self):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task: shared=False) as task:
self.assertRaises(exception.InvalidParameterValue, self.assertRaises(exception.InvalidParameterValue,
task.driver.management.erase_devices, task.driver.management.erase_devices,
task, erase_pattern={'ssd': 'xyz'}) task, erase_pattern={'ssd': 'xyz'})
@mock.patch.object(ilo_management.LOG, 'error', autospec=True)
@mock.patch.object(ilo_common, 'get_ilo_object', autospec=True) @mock.patch.object(ilo_common, 'get_ilo_object', autospec=True)
@mock.patch.object(manager_utils, 'cleaning_error_handler', @mock.patch.object(manager_utils, 'cleaning_error_handler',
autospec=True) autospec=True)
def test_erase_devices_hdd_ilo_error(self, clean_err_handler_mock, def test_erase_devices_hdd_ilo_error(self, clean_err_handler_mock,
ilo_mock, log_mock): ilo_mock):
ilo_mock_object = ilo_mock.return_value ilo_mock_object = ilo_mock.return_value
ilo_mock_object.get_available_disk_types.return_value = ['HDD'] ilo_mock_object.get_available_disk_types.return_value = ['HDD']
exc = ilo_error.IloError('error') exc = ilo_error.IloError('error')
ilo_mock_object.do_disk_erase.side_effect = exc ilo_mock_object.do_disk_erase.side_effect = exc
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task: shared=False) as task:
task.driver.management.erase_devices(task) task.driver.management.erase_devices(task)
ilo_mock_object.do_disk_erase.assert_called_once_with( ilo_mock_object.do_disk_erase.assert_called_once_with(
'HDD', 'overwrite') 'HDD', 'overwrite')
self.assertNotIn('ilo_disk_erase_hdd_check', self.assertNotIn('ilo_disk_erase_hdd_check',
task.node.driver_internal_info) task.node.driver_internal_info)
self.assertNotIn('ilo_disk_erase_ssd_check', self.assertNotIn('ilo_disk_erase_ssd_check',
task.node.driver_internal_info) task.node.driver_internal_info)
self.assertNotIn('cleaning_reboot', self.assertNotIn('cleaning_reboot',
task.node.driver_internal_info) task.node.driver_internal_info)
self.assertNotIn('skip_current_clean_step', self.assertNotIn('skip_current_clean_step',
task.node.driver_internal_info) task.node.driver_internal_info)
self.assertTrue(log_mock.called) clean_err_handler_mock.assert_called_once_with(
clean_err_handler_mock.assert_called_once_with(task, exc) task,
("Out-of-band sanitize disk erase job failed for node %s. "
"Message: 'error'." % task.node.uuid),
errmsg=exc)
@mock.patch.object(manager_utils, 'node_power_action', autospec=True) @mock.patch.object(manager_utils, 'node_power_action', autospec=True)
@mock.patch.object(ilo_common, 'get_ilo_object', autospec=True) @mock.patch.object(ilo_common, 'get_ilo_object', autospec=True)
def test_one_button_secure_erase(self, ilo_mock, mock_power): def test_one_button_secure_erase(self, ilo_mock, mock_power):
ilo_mock_object = ilo_mock.return_value ilo_mock_object = ilo_mock.return_value
self.node.clean_step = {'step': 'one_button_secure_erase', self.node.clean_step = {'step': 'one_button_secure_erase',
'interface': 'management'} 'interface': 'management'}
self.node.save() self.node.save()
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task: shared=False) as task:
result = task.driver.management.one_button_secure_erase(task) result = task.driver.management.one_button_secure_erase(task)
self.assertTrue( self.assertTrue(
ilo_mock_object.do_one_button_secure_erase.called) ilo_mock_object.do_one_button_secure_erase.called)
self.assertEqual(states.CLEANWAIT, result) self.assertEqual(states.CLEANWAIT, result)
mock_power.assert_called_once_with(task, states.REBOOT) mock_power.assert_called_once_with(task, states.REBOOT)
self.assertEqual(task.node.maintenance, True) self.assertEqual(task.node.maintenance, True)
@mock.patch.object(ilo_management.LOG, 'error', autospec=True)
@mock.patch.object(ilo_common, 'get_ilo_object', autospec=True) @mock.patch.object(ilo_common, 'get_ilo_object', autospec=True)
@mock.patch.object(manager_utils, 'cleaning_error_handler', @mock.patch.object(manager_utils, 'cleaning_error_handler',
autospec=True) autospec=True)
def test_one_button_secure_erase_ilo_error( def test_one_button_secure_erase_ilo_error(
self, clean_err_handler_mock, ilo_mock, log_mock): self, clean_err_handler_mock, ilo_mock):
ilo_mock_object = ilo_mock.return_value ilo_mock_object = ilo_mock.return_value
self.node.clean_step = {'step': 'one_button_secure_erase', self.node.clean_step = {'step': 'one_button_secure_erase',
'interface': 'management'} 'interface': 'management'}
self.node.save() self.node.save()
exc = ilo_error.IloError('error') exc = ilo_error.IloError('error')
ilo_mock_object.do_one_button_secure_erase.side_effect = exc ilo_mock_object.do_one_button_secure_erase.side_effect = exc
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task: shared=False) as task:
task.driver.management.one_button_secure_erase(task) task.driver.management.one_button_secure_erase(task)
clean_err_handler_mock.assert_called_once_with(task, exc) clean_err_handler_mock.assert_called_once_with(
task,
("One button secure erase job failed for node %s. "
"Message: 'error'." % task.node.uuid),
errmsg=exc)
self.assertTrue( self.assertTrue(
ilo_mock_object.do_one_button_secure_erase.called) ilo_mock_object.do_one_button_secure_erase.called)
self.assertTrue(log_mock.called)
 End of changes. 7 change blocks. 
7 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)