summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Pittau <elfosardo@gmail.com>2022-12-15 11:49:34 +0100
committerRiccardo Pittau <elfosardo@gmail.com>2022-12-15 11:49:34 +0100
commit604c7081dbb6b1542c30e93e25e3f231acd146e2 (patch)
treea4d77101ca95ac4cd12ca321353c99825c703e92
parenta1670753a23a79b6536f67eae9cca154e0ed2e65 (diff)
downloadironic-python-agent-604c7081dbb6b1542c30e93e25e3f231acd146e2.tar.gz
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
-rw-r--r--ironic_python_agent/tests/unit/test_hardware.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py
index 9fcf775c..ab4f9cc0 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)