Merge "Fix httpboot handling and unit tests"

This commit is contained in:
Zuul 2024-07-09 16:50:30 +00:00 committed by Gerrit Code Review
commit bf4dbdbc53
2 changed files with 13 additions and 6 deletions

View File

@ -497,12 +497,17 @@ def system_resource(identity):
app.logger.error('Unable to record HttpBootUri for boot '
'operation. Error: %s', e)
return 'Failed to save HttpBootUri field value.', 400
# Explicitly set to CD as in this case we will boot a an iso
# image provided, not precisely the same, but BMC facilitated
# HTTPBoot is a little different and the overall functionality
# test is more important.
target = 'Cd'
if target == 'UefiHttp':
# Reset to Cd, in our case, since we can't force override
if target == 'UefiHttp' and not http_uri:
# Reset to Pxe, in our case, since we can't force override
# the network boot to a specific URL. This is sort of a hack
# but testing functionality overall is a bit more important.
target = 'Cd'
target = 'Pxe'
if target:
# NOTE(lucasagomes): In libvirt we always set the boot

View File

@ -144,8 +144,9 @@ class VirtualMediaTestCase(test_main.EmulatorTestCase):
self.assertEqual(204, response.status_code)
vmedia_mock.return_value.insert_image.called_once_with(
'CD', 'http://fish.iso', True, False)
vmedia_mock.return_value.insert_image.assert_called_once_with(
self.uuid, 'CD', 'http://fish.iso', True, True,
username='', password='')
def test_virtual_media_eject(self, systems_mock, vmedia_mock):
response = self.app.post(
@ -155,7 +156,8 @@ class VirtualMediaTestCase(test_main.EmulatorTestCase):
self.assertEqual(204, response.status_code)
vmedia_mock.return_value.eject_image.called_once_with('CD')
vmedia_mock.return_value.eject_image.assert_called_once_with(
self.uuid, 'CD')
def test_virtual_media_certificates(self, systems_mock, vmedia_mock):
vmedia_mock.return_value.list_certificates.return_value = [