"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/tests/unit/drivers/modules/drac/test_periodic_task.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_periodic_task.py  (ironic-16.0.2):test_periodic_task.py  (ironic-16.0.3)
skipping to change at line 205 skipping to change at line 205
self._test__check_node_raid_jobs_with_completed_job( self._test__check_node_raid_jobs_with_completed_job(
mock_notify_conductor_resume) mock_notify_conductor_resume)
@mock.patch.object(manager_utils, 'notify_conductor_resume_deploy', @mock.patch.object(manager_utils, 'notify_conductor_resume_deploy',
autospec=True) autospec=True)
def test__check_node_raid_jobs_with_completed_job_in_deploy( def test__check_node_raid_jobs_with_completed_job_in_deploy(
self, mock_notify_conductor_resume): self, mock_notify_conductor_resume):
self._test__check_node_raid_jobs_with_completed_job( self._test__check_node_raid_jobs_with_completed_job(
mock_notify_conductor_resume) mock_notify_conductor_resume)
@mock.patch.object(manager_utils, 'cleaning_error_handler', autospec=True)
@mock.patch.object(drac_common, 'get_drac_client', spec_set=True, @mock.patch.object(drac_common, 'get_drac_client', spec_set=True,
autospec=True) autospec=True)
def test__check_node_raid_jobs_with_failed_job(self, mock_get_drac_client): def test__check_node_raid_jobs_with_failed_job(
self, mock_get_drac_client, mock_cleaning_error_handler):
# mock node.driver_internal_info and node.clean_step # mock node.driver_internal_info and node.clean_step
driver_internal_info = {'raid_config_job_ids': ['42']} driver_internal_info = {'raid_config_job_ids': ['42']}
self.node.driver_internal_info = driver_internal_info self.node.driver_internal_info = driver_internal_info
self.node.clean_step = {'foo': 'bar'} self.node.clean_step = {'foo': 'bar'}
self.node.save() self.node.save()
# mock task # mock task
task = mock.Mock(node=self.node, context=self.context) task = mock.Mock(node=self.node, context=self.context)
# mock dracclient.get_job # mock dracclient.get_job
self.job['status'] = 'Failed' self.job['status'] = 'Failed'
self.job['message'] = 'boom' self.job['message'] = 'boom'
skipping to change at line 234 skipping to change at line 236
test_utils.dict_to_namedtuple(values=self.virtual_disk)] test_utils.dict_to_namedtuple(values=self.virtual_disk)]
self.raid._check_node_raid_jobs(task) self.raid._check_node_raid_jobs(task)
mock_client.get_job.assert_called_once_with('42') mock_client.get_job.assert_called_once_with('42')
self.assertEqual(0, mock_client.list_virtual_disks.call_count) self.assertEqual(0, mock_client.list_virtual_disks.call_count)
self.node.refresh() self.node.refresh()
self.assertEqual([], self.assertEqual([],
self.node.driver_internal_info['raid_config_job_ids']) self.node.driver_internal_info['raid_config_job_ids'])
self.assertEqual({}, self.node.raid_config) self.assertEqual({}, self.node.raid_config)
task.process_event.assert_called_once_with('fail') mock_cleaning_error_handler.assert_called_once_with(task, mock.ANY)
@mock.patch.object(manager_utils, 'deploying_error_handler', autospec=True)
@mock.patch.object(manager_utils, 'cleaning_error_handler', autospec=True)
@mock.patch.object(drac_common, 'get_drac_client', spec_set=True, @mock.patch.object(drac_common, 'get_drac_client', spec_set=True,
autospec=True) autospec=True)
@mock.patch.object(drac_raid.DracRAID, 'get_logical_disks', @mock.patch.object(drac_raid.DracRAID, 'get_logical_disks',
spec_set=True, autospec=True) spec_set=True, autospec=True)
def _test__check_node_raid_jobs_with_completed_job_already_failed( def _test__check_node_raid_jobs_with_completed_job_already_failed(
self, mock_notify_conductor_resume, self, mock_notify_conductor_resume,
mock_get_logical_disks, mock_get_drac_client): mock_get_logical_disks, mock_get_drac_client,
mock_cleaning_error_handler, mock_deploying_error_handler):
expected_logical_disk = {'size_gb': 558, expected_logical_disk = {'size_gb': 558,
'raid_level': '1', 'raid_level': '1',
'name': 'disk 0'} 'name': 'disk 0'}
# mock node.driver_internal_info # mock node.driver_internal_info
driver_internal_info = {'raid_config_job_ids': ['42'], driver_internal_info = {'raid_config_job_ids': ['42'],
'raid_config_job_failure': True} 'raid_config_job_failure': True}
self.node.driver_internal_info = driver_internal_info self.node.driver_internal_info = driver_internal_info
self.node.save() self.node.save()
# mock task # mock task
task = mock.Mock(node=self.node, context=self.context) task = mock.Mock(node=self.node, context=self.context)
skipping to change at line 273 skipping to change at line 278
self.raid._check_node_raid_jobs(task) self.raid._check_node_raid_jobs(task)
mock_client.get_job.assert_called_once_with('42') mock_client.get_job.assert_called_once_with('42')
self.node.refresh() self.node.refresh()
self.assertEqual([], self.assertEqual([],
self.node.driver_internal_info['raid_config_job_ids']) self.node.driver_internal_info['raid_config_job_ids'])
self.assertNotIn('raid_config_job_failure', self.assertNotIn('raid_config_job_failure',
self.node.driver_internal_info) self.node.driver_internal_info)
self.assertNotIn('logical_disks', self.node.raid_config) self.assertNotIn('logical_disks', self.node.raid_config)
task.process_event.assert_called_once_with('fail') if self.node.clean_step:
mock_cleaning_error_handler.assert_called_once_with(task, mock.ANY)
else:
mock_deploying_error_handler.assert_called_once_with(task,
mock.ANY,
mock.ANY)
self.assertFalse(mock_notify_conductor_resume.called) self.assertFalse(mock_notify_conductor_resume.called)
@mock.patch.object(manager_utils, 'notify_conductor_resume_clean', @mock.patch.object(manager_utils, 'notify_conductor_resume_clean',
autospec=True) autospec=True)
def test__check_node_raid_jobs_with_completed_job_already_failed_in_clean( def test__check_node_raid_jobs_with_completed_job_already_failed_in_clean(
self, mock_notify_conductor_resume): self, mock_notify_conductor_resume):
self.node.clean_step = {'foo': 'bar'} self.node.clean_step = {'foo': 'bar'}
self.node.save() self.node.save()
self._test__check_node_raid_jobs_with_completed_job_already_failed( self._test__check_node_raid_jobs_with_completed_job_already_failed(
mock_notify_conductor_resume) mock_notify_conductor_resume)
skipping to change at line 348 skipping to change at line 358
self._test__check_node_raid_jobs_with_multiple_jobs_completed( self._test__check_node_raid_jobs_with_multiple_jobs_completed(
mock_notify_conductor_resume) mock_notify_conductor_resume)
@mock.patch.object(manager_utils, 'notify_conductor_resume_deploy', @mock.patch.object(manager_utils, 'notify_conductor_resume_deploy',
autospec=True) autospec=True)
def test__check_node_raid_jobs_with_multiple_jobs_completed_in_deploy( def test__check_node_raid_jobs_with_multiple_jobs_completed_in_deploy(
self, mock_notify_conductor_resume): self, mock_notify_conductor_resume):
self._test__check_node_raid_jobs_with_multiple_jobs_completed( self._test__check_node_raid_jobs_with_multiple_jobs_completed(
mock_notify_conductor_resume) mock_notify_conductor_resume)
@mock.patch.object(manager_utils, 'deploying_error_handler', autospec=True)
@mock.patch.object(manager_utils, 'cleaning_error_handler', autospec=True)
@mock.patch.object(drac_common, 'get_drac_client', spec_set=True, @mock.patch.object(drac_common, 'get_drac_client', spec_set=True,
autospec=True) autospec=True)
@mock.patch.object(drac_raid.DracRAID, 'get_logical_disks', @mock.patch.object(drac_raid.DracRAID, 'get_logical_disks',
spec_set=True, autospec=True) spec_set=True, autospec=True)
def _test__check_node_raid_jobs_with_multiple_jobs_failed( def _test__check_node_raid_jobs_with_multiple_jobs_failed(
self, mock_notify_conductor_resume, self, mock_notify_conductor_resume,
mock_get_logical_disks, mock_get_drac_client): mock_get_logical_disks, mock_get_drac_client,
mock_cleaning_error_handler, mock_deploying_error_handler):
expected_logical_disk = {'size_gb': 558, expected_logical_disk = {'size_gb': 558,
'raid_level': '1', 'raid_level': '1',
'name': 'disk 0'} 'name': 'disk 0'}
# mock node.driver_internal_info # mock node.driver_internal_info
driver_internal_info = {'raid_config_job_ids': ['42', '36']} driver_internal_info = {'raid_config_job_ids': ['42', '36']}
self.node.driver_internal_info = driver_internal_info self.node.driver_internal_info = driver_internal_info
self.node.save() self.node.save()
# mock task # mock task
task = mock.Mock(node=self.node, context=self.context) task = mock.Mock(node=self.node, context=self.context)
# mock dracclient.get_job # mock dracclient.get_job
skipping to change at line 389 skipping to change at line 402
self.raid._check_node_raid_jobs(task) self.raid._check_node_raid_jobs(task)
mock_client.get_job.assert_has_calls([mock.call('42'), mock_client.get_job.assert_has_calls([mock.call('42'),
mock.call('36')]) mock.call('36')])
self.node.refresh() self.node.refresh()
self.assertEqual([], self.assertEqual([],
self.node.driver_internal_info['raid_config_job_ids']) self.node.driver_internal_info['raid_config_job_ids'])
self.assertNotIn('raid_config_job_failure', self.assertNotIn('raid_config_job_failure',
self.node.driver_internal_info) self.node.driver_internal_info)
self.assertNotIn('logical_disks', self.node.raid_config) self.assertNotIn('logical_disks', self.node.raid_config)
task.process_event.assert_called_once_with('fail') if self.node.clean_step:
mock_cleaning_error_handler.assert_called_once_with(task, mock.ANY)
else:
mock_deploying_error_handler.assert_called_once_with(task,
mock.ANY,
mock.ANY)
self.assertFalse(mock_notify_conductor_resume.called) self.assertFalse(mock_notify_conductor_resume.called)
@mock.patch.object(manager_utils, 'notify_conductor_resume_clean', @mock.patch.object(manager_utils, 'notify_conductor_resume_clean',
autospec=True) autospec=True)
def test__check_node_raid_jobs_with_multiple_jobs_failed_in_clean( def test__check_node_raid_jobs_with_multiple_jobs_failed_in_clean(
self, mock_notify_conductor_resume): self, mock_notify_conductor_resume):
self.node.clean_step = {'foo': 'bar'} self.node.clean_step = {'foo': 'bar'}
self.node.save() self.node.save()
self._test__check_node_raid_jobs_with_multiple_jobs_failed( self._test__check_node_raid_jobs_with_multiple_jobs_failed(
mock_notify_conductor_resume) mock_notify_conductor_resume)
 End of changes. 9 change blocks. 
6 lines changed or deleted 24 lines changed or added

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