From 604c7081dbb6b1542c30e93e25e3f231acd146e2 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Thu, 15 Dec 2022 11:49:34 +0100 Subject: [PATCH] Fix create configuration unit tests The unit tests for create_configuration give different result if ran on a bios or uefi booted machine because they get the partition table type value based on the utils function get_node_boot_mode. Let's mock the boot_mode as we do in other tests to get an independent result. Change-Id: Ic0e7daea7ec4ce0806cd126c27166f84690c5d9e --- ironic_python_agent/tests/unit/test_hardware.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py index 9fcf775c4..ab4f9cc0c 100644 --- a/ironic_python_agent/tests/unit/test_hardware.py +++ b/ironic_python_agent/tests/unit/test_hardware.py @@ -4492,6 +4492,7 @@ class TestGenericHardwareManager(base.IronicAgentTest): self.hardware.create_configuration, self.node, []) + @mock.patch.object(utils, 'get_node_boot_mode', lambda node: 'bios') @mock.patch.object(raid_utils, 'get_volume_name_of_raid_device', autospec=True) @mock.patch.object(raid_utils, '_get_actual_component_devices', @@ -4626,6 +4627,7 @@ class TestGenericHardwareManager(base.IronicAgentTest): mocked_execute.assert_called_once_with( 'mdadm', '--examine', '/dev/md0', use_standard_locale=True) + @mock.patch.object(utils, 'get_node_boot_mode', lambda node: 'bios') @mock.patch.object(raid_utils, '_get_actual_component_devices', autospec=True) @mock.patch.object(hardware, 'list_all_block_devices', autospec=True)