"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/tests/unit/drivers/modules/test_image_utils.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_image_utils.py  (ironic-16.0.2):test_image_utils.py  (ironic-16.0.3)
skipping to change at line 253 skipping to change at line 253
'http://bootloader/img', root_uuid=task.node.uuid) 'http://bootloader/img', root_uuid=task.node.uuid)
object_name = 'boot-%s.iso' % task.node.uuid object_name = 'boot-%s.iso' % task.node.uuid
mock_publish_image.assert_called_once_with( mock_publish_image.assert_called_once_with(
mock.ANY, mock.ANY, object_name) mock.ANY, mock.ANY, object_name)
mock_create_boot_iso.assert_called_once_with( mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img', mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='uefi', esp_image_href='http://bootloader/img', boot_mode='uefi', esp_image_href='http://bootloader/img',
configdrive_href=mock.ANY,
kernel_params='nofb nomodeset vga=normal', kernel_params='nofb nomodeset vga=normal',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123', root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
base_iso=None) base_iso=None, inject_files=None)
self.assertEqual(expected_url, url) self.assertEqual(expected_url, url)
@mock.patch.object(image_utils.ImageHandler, 'publish_image', @mock.patch.object(image_utils.ImageHandler, 'publish_image',
autospec=True) autospec=True)
@mock.patch.object(images, 'create_boot_iso', autospec=True) @mock.patch.object(images, 'create_boot_iso', autospec=True)
def test__prepare_iso_image_default_boot_mode( def test__prepare_iso_image_default_boot_mode(
self, mock_create_boot_iso, mock_publish_image): self, mock_create_boot_iso, mock_publish_image):
self.config(default_boot_mode='uefi', group='deploy') self.config(default_boot_mode='uefi', group='deploy')
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
image_utils._prepare_iso_image( image_utils._prepare_iso_image(
task, 'http://kernel/img', 'http://ramdisk/img', task, 'http://kernel/img', 'http://ramdisk/img',
bootloader_href=None, root_uuid=task.node.uuid, bootloader_href=None, root_uuid=task.node.uuid,
base_iso='/path/to/baseiso') base_iso='/path/to/baseiso')
mock_create_boot_iso.assert_called_once_with( mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img', mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='uefi', esp_image_href=None, boot_mode='uefi', esp_image_href=None,
configdrive_href=mock.ANY,
kernel_params='nofb nomodeset vga=normal', kernel_params='nofb nomodeset vga=normal',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123', root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
base_iso='/path/to/baseiso') base_iso='/path/to/baseiso', inject_files=None)
@mock.patch.object(image_utils.ImageHandler, 'publish_image', @mock.patch.object(image_utils.ImageHandler, 'publish_image',
autospec=True) autospec=True)
@mock.patch.object(images, 'create_boot_iso', autospec=True) @mock.patch.object(images, 'create_boot_iso', autospec=True)
def test__prepare_iso_image_bios( def test__prepare_iso_image_bios(
self, mock_create_boot_iso, mock_publish_image): self, mock_create_boot_iso, mock_publish_image):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
expected_url = 'https://a.b/c.f?e=f' expected_url = 'https://a.b/c.f?e=f'
skipping to change at line 305 skipping to change at line 303
bootloader_href=None, root_uuid=task.node.uuid, base_iso=None) bootloader_href=None, root_uuid=task.node.uuid, base_iso=None)
object_name = 'boot-%s.iso' % task.node.uuid object_name = 'boot-%s.iso' % task.node.uuid
mock_publish_image.assert_called_once_with( mock_publish_image.assert_called_once_with(
mock.ANY, mock.ANY, object_name) mock.ANY, mock.ANY, object_name)
mock_create_boot_iso.assert_called_once_with( mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img', mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='bios', esp_image_href=None, boot_mode='bios', esp_image_href=None,
configdrive_href=mock.ANY,
kernel_params='nofb nomodeset vga=normal', kernel_params='nofb nomodeset vga=normal',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123', root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
base_iso=None) base_iso=None, inject_files=None)
self.assertEqual(expected_url, url) self.assertEqual(expected_url, url)
@mock.patch.object(image_utils.ImageHandler, 'publish_image', @mock.patch.object(image_utils.ImageHandler, 'publish_image',
autospec=True) autospec=True)
@mock.patch.object(images, 'create_boot_iso', autospec=True) @mock.patch.object(images, 'create_boot_iso', autospec=True)
def test__prepare_iso_image_kernel_params( def test__prepare_iso_image_kernel_params(
self, mock_create_boot_iso, mock_publish_image): self, mock_create_boot_iso, mock_publish_image):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
skipping to change at line 331 skipping to change at line 328
task.node.instance_info.update(kernel_append_params=kernel_params) task.node.instance_info.update(kernel_append_params=kernel_params)
image_utils._prepare_iso_image( image_utils._prepare_iso_image(
task, 'http://kernel/img', 'http://ramdisk/img', task, 'http://kernel/img', 'http://ramdisk/img',
bootloader_href=None, root_uuid=task.node.uuid, bootloader_href=None, root_uuid=task.node.uuid,
base_iso='/path/to/baseiso') base_iso='/path/to/baseiso')
mock_create_boot_iso.assert_called_once_with( mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img', mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='bios', esp_image_href=None, boot_mode='bios', esp_image_href=None,
configdrive_href=mock.ANY,
kernel_params=kernel_params, kernel_params=kernel_params,
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123', root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
base_iso='/path/to/baseiso') base_iso='/path/to/baseiso', inject_files=None)
def test__find_param(self): def test__find_param(self):
param_dict = { param_dict = {
'ilo_deploy_kernel': 'kernel', 'ilo_deploy_kernel': 'kernel',
'ilo_deploy_ramdisk': 'ramdisk', 'ilo_deploy_ramdisk': 'ramdisk',
'ilo_bootloader': 'bootloader' 'ilo_bootloader': 'bootloader'
} }
param_str = "deploy_kernel" param_str = "deploy_kernel"
expected = "kernel" expected = "kernel"
skipping to change at line 386 skipping to change at line 382
] ]
find_mock.side_effect = [ find_mock.side_effect = [
'kernel', 'ramdisk', 'bootloader' 'kernel', 'ramdisk', 'bootloader'
] ]
task.node.instance_info.update(deploy_boot_mode='uefi') task.node.instance_info.update(deploy_boot_mode='uefi')
image_utils.prepare_deploy_iso(task, {}, 'deploy', d_info) image_utils.prepare_deploy_iso(task, {}, 'deploy', d_info)
mock__prepare_iso_image.assert_called_once_with( mock__prepare_iso_image.assert_called_once_with(
task, 'kernel', 'ramdisk', 'bootloader', params={}) task, 'kernel', 'ramdisk', 'bootloader', params={},
inject_files={})
find_mock.assert_has_calls(find_call_list) find_mock.assert_has_calls(find_call_list)
@mock.patch.object(image_utils, '_find_param', autospec=True) @mock.patch.object(image_utils, '_find_param', autospec=True)
@mock.patch.object(image_utils, '_prepare_iso_image', autospec=True) @mock.patch.object(image_utils, '_prepare_iso_image', autospec=True)
@mock.patch.object(images, 'create_vfat_image', autospec=True)
def test_prepare_deploy_iso_network_data( def test_prepare_deploy_iso_network_data(
self, mock_create_vfat_image, mock__prepare_iso_image, self, mock__prepare_iso_image, find_mock):
find_mock):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
d_info = { d_info = {
'ilo_deploy_kernel': 'kernel', 'ilo_deploy_kernel': 'kernel',
'ilo_deploy_ramdisk': 'ramdisk' 'ilo_deploy_ramdisk': 'ramdisk'
} }
task.node.driver_info.update(d_info) task.node.driver_info.update(d_info)
task.node.instance_info.update() task.node.instance_info.update()
skipping to change at line 422 skipping to change at line 417
find_mock.side_effect = [ find_mock.side_effect = [
'kernel', 'ramdisk', None 'kernel', 'ramdisk', None
] ]
network_data = {'a': ['b']} network_data = {'a': ['b']}
mock_get_node_nw_data = mock.MagicMock(return_value=network_data) mock_get_node_nw_data = mock.MagicMock(return_value=network_data)
task.driver.network.get_node_network_data = mock_get_node_nw_data task.driver.network.get_node_network_data = mock_get_node_nw_data
image_utils.prepare_deploy_iso(task, {}, 'deploy', d_info) image_utils.prepare_deploy_iso(task, {}, 'deploy', d_info)
mock_create_vfat_image.assert_called_once_with( expected_files = {
mock.ANY, mock.ANY) b"""{
"a": [
"b"
]
}""": 'openstack/latest/network_data.json'
}
mock__prepare_iso_image.assert_called_once_with( mock__prepare_iso_image.assert_called_once_with(
task, 'kernel', 'ramdisk', bootloader_href=None, task, 'kernel', 'ramdisk', bootloader_href=None,
configdrive=mock.ANY, params={}) params={}, inject_files=expected_files)
find_mock.assert_has_calls(find_call_list) find_mock.assert_has_calls(find_call_list)
@mock.patch.object(image_utils, '_find_param', autospec=True) @mock.patch.object(image_utils, '_find_param', autospec=True)
@mock.patch.object(image_utils, '_prepare_iso_image', autospec=True) @mock.patch.object(image_utils, '_prepare_iso_image', autospec=True)
@mock.patch.object(images, 'create_boot_iso', autospec=True) @mock.patch.object(images, 'create_boot_iso', autospec=True)
def test_prepare_boot_iso(self, mock_create_boot_iso, def test_prepare_boot_iso(self, mock_create_boot_iso,
mock__prepare_iso_image, find_mock): mock__prepare_iso_image, find_mock):
with task_manager.acquire(self.context, self.node.uuid, with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: shared=True) as task:
 End of changes. 13 change blocks. 
15 lines changed or deleted 15 lines changed or added

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