"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/tests/unit/drivers/modules/test_image_utils.py" between
ironic-17.0.2.tar.gz and ironic-17.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 "Wallaby" series (latest release).

test_image_utils.py  (ironic-17.0.2):test_image_utils.py  (ironic-17.0.3)
skipping to change at line 16 skipping to change at line 16
# a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import collections
import os import os
import tempfile import tempfile
from unittest import mock from unittest import mock
from oslo_utils import importutils from oslo_utils import importutils
from ironic.common import images from ironic.common import images
from ironic.common import utils from ironic.common import utils
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.drivers.modules import image_utils from ironic.drivers.modules import image_utils
skipping to change at line 552 skipping to change at line 553
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,
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', inject_files=None) base_iso='/path/to/baseiso', inject_files=None)
@mock.patch.object(image_utils.ImageHandler, 'publish_image',
autospec=True)
@mock.patch.object(images, 'create_boot_iso', autospec=True)
def test__prepare_iso_image_extra_params(
self, mock_create_boot_iso, mock_publish_image):
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
kernel_params = 'network-config=base64-cloudinit-blob'
extra_params = collections.OrderedDict([('foo', 'bar'),
('banana', None)])
self.config(kernel_append_params=kernel_params, group='redfish')
image_utils._prepare_iso_image(
task, 'http://kernel/img', 'http://ramdisk/img',
root_uuid=task.node.uuid, params=extra_params)
mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
boot_mode='bios', esp_image_href=None,
kernel_params=kernel_params + ' foo=bar banana',
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
base_iso=None, inject_files=None)
def test__prepare_iso_image_bootable_iso(self):
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
base_image_url = 'http://bearmetal.net/boot.iso'
self.config(ramdisk_image_download_source='http', group='deploy')
url = image_utils._prepare_iso_image(
task, None, None, bootloader_href=None, root_uuid=None,
base_iso=base_image_url)
self.assertEqual(url, base_image_url)
@mock.patch.object(image_utils.ImageHandler, 'publish_image',
autospec=True)
@mock.patch.object(images, 'create_boot_iso', autospec=True)
def test__prepare_iso_image_bootable_iso_file(self, mock_create_boot_iso,
mock_publish_image):
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
base_image_url = '/path/to/baseiso'
self.config(ramdisk_image_download_source='http', group='deploy')
image_utils._prepare_iso_image(
task, 'http://kernel/img', 'http://ramdisk/img',
bootloader_href=None, root_uuid=task.node.uuid,
base_iso=base_image_url)
mock_create_boot_iso.assert_called_once_with(
mock.ANY, mock.ANY, 'http://kernel/img', 'http://ramdisk/img',
esp_image_href=None,
root_uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
kernel_params='nofb nomodeset vga=normal', boot_mode='bios',
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"
actual = image_utils._find_param(param_str, param_dict) actual = image_utils._find_param(param_str, param_dict)
 End of changes. 2 change blocks. 
0 lines changed or deleted 54 lines changed or added

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