summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests/unit
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2021-01-26 18:27:52 +0100
committerDmitry Tantsur <dtantsur@protonmail.com>2021-02-10 18:08:58 +0100
commit403d2f06c670475b95de2bd971dcfcb83f166529 (patch)
treeb4de7d1db032cfd22006196807632bc9a98f2d6e /ironic_python_agent/tests/unit
parent68d9c70fbaff3ed20102886fc90ea2c773d3263a (diff)
downloadironic-python-agent-403d2f06c670475b95de2bd971dcfcb83f166529.tar.gz
Fix error message with UEFI-incompatible images
It's somewhat confusing at the moment, since we're trying to find a UEFI partition by UUID "None". Don't search for partition if we don't know its UUID, and provide a better error message. Change-Id: Ief874084132797a445ddae8009264712a05facfd
Diffstat (limited to 'ironic_python_agent/tests/unit')
-rw-r--r--ironic_python_agent/tests/unit/extensions/test_image.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_image.py b/ironic_python_agent/tests/unit/extensions/test_image.py
index 55ee60f7..d7093b6b 100644
--- a/ironic_python_agent/tests/unit/extensions/test_image.py
+++ b/ironic_python_agent/tests/unit/extensions/test_image.py
@@ -2107,6 +2107,16 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
mock_get_part_uuid,
mock_execute, mock_dispatch):
mock_utils_efi_part.return_value = None
+ self.assertRaises(errors.DeviceNotFound,
+ image._manage_uefi, self.fake_dev, None)
+ self.assertFalse(mock_get_part_uuid.called)
+
+ @mock.patch.object(image, '_get_partition', autospec=True)
+ @mock.patch.object(utils, 'get_efi_part_on_device', autospec=True)
+ def test__manage_uefi_empty_partition_by_uuid(self, mock_utils_efi_part,
+ mock_get_part_uuid,
+ mock_execute, mock_dispatch):
+ mock_utils_efi_part.return_value = None
mock_get_part_uuid.return_value = self.fake_root_part
result = image._manage_uefi(self.fake_dev, self.fake_root_uuid)
self.assertFalse(result)