summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests/hardware.py
diff options
context:
space:
mode:
authorJay Faulkner <jay@jvf.cc>2014-12-19 13:24:21 -0800
committerJay Faulkner <jay@jvf.cc>2015-01-08 15:15:13 -0800
commit2bbec5770c459b339b0924e8ffcd1382e22d44df (patch)
tree1a1035f408aa3d1557a9d91772c4f5f71e820c2f /ironic_python_agent/tests/hardware.py
parent8dd54446e3a7a1e13fee91a4f7cfa064b085b03b (diff)
downloadironic-python-agent-2bbec5770c459b339b0924e8ffcd1382e22d44df.tar.gz
Allow use of multiple simultaneous HW managers
Currently we pick the most specific manager and use it. Instead, call each method on each hardware manager in priority order, and consider the call successful if the method exists and doesn't throw IncompatibleHardwareMethodError. This is an API breaking change for anyone with out-of-tree HardwareManagers. Closes-bug: 1408469 Change-Id: I30c65c9259acd4f200cb554e7d688344b7486a58
Diffstat (limited to 'ironic_python_agent/tests/hardware.py')
-rw-r--r--ironic_python_agent/tests/hardware.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/ironic_python_agent/tests/hardware.py b/ironic_python_agent/tests/hardware.py
index d6c5f143..fa107d10 100644
--- a/ironic_python_agent/tests/hardware.py
+++ b/ironic_python_agent/tests/hardware.py
@@ -157,17 +157,6 @@ class TestHardwareManagerLoading(test_base.BaseTestCase):
ext1, ext2, ext3
])
- @mock.patch('stevedore.ExtensionManager')
- def test_hardware_manager_loading(self, mocked_extension_mgr_constructor):
- hardware._global_manager = None
- mocked_extension_mgr_constructor.return_value = self.fake_ext_mgr
-
- preferred_hw_manager = hardware.get_manager()
- mocked_extension_mgr_constructor.assert_called_once_with(
- namespace='ironic_python_agent.hardware_managers',
- invoke_on_load=True)
- self.assertEqual(self.correct_hw_manager, preferred_hw_manager)
-
class TestGenericHardwareManager(test_base.BaseTestCase):
def setUp(self):
@@ -355,7 +344,7 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
])
@mock.patch.object(utils, 'execute')
- def test_erase_block_device_ata_nosecurtiy(self, mocked_execute):
+ def test_erase_block_device_ata_nosecurity(self, mocked_execute):
hdparm_output = HDPARM_INFO_TEMPLATE.split('\nSecurity:')[0]
mocked_execute.side_effect = [
@@ -364,7 +353,7 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
block_device = hardware.BlockDevice('/dev/sda', 'big', 1073741824,
True)
- self.assertRaises(errors.BlockDeviceEraseError,
+ self.assertRaises(errors.IncompatibleHardwareMethodError,
self.hardware.erase_block_device,
block_device)
@@ -382,7 +371,7 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
block_device = hardware.BlockDevice('/dev/sda', 'big', 1073741824,
True)
- self.assertRaises(errors.BlockDeviceEraseError,
+ self.assertRaises(errors.IncompatibleHardwareMethodError,
self.hardware.erase_block_device,
block_device)