summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests
diff options
context:
space:
mode:
authorKaifeng Wang <kaifeng.w@gmail.com>2018-10-24 10:48:27 +0800
committerKaifeng Wang <kaifeng.w@gmail.com>2018-10-24 10:51:43 +0800
commit6f42768756db503e7ef9152b35c0e106b87c5be0 (patch)
tree0e37f93d4605fba54b6f5557adc51250272180b7 /ironic_python_agent/tests
parent0a275992f214e7bd896ca8321b3f7a3f66f77f94 (diff)
downloadironic-python-agent-6f42768756db503e7ef9152b35c0e106b87c5be0.tar.gz
Follow up to parallel disk erasure
Improve test to verify apply_async is called twice as expected. Story: 1546949 Task: 11548 Change-Id: I41736dfb2932dd0036bbc4cbc51929bf61a16569
Diffstat (limited to 'ironic_python_agent/tests')
-rw-r--r--ironic_python_agent/tests/unit/test_hardware.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py
index 316493d5..2f66f137 100644
--- a/ironic_python_agent/tests/unit/test_hardware.py
+++ b/ironic_python_agent/tests/unit/test_hardware.py
@@ -1308,17 +1308,19 @@ class TestGenericHardwareManager(base.IronicAgentTest):
apply_result.get = lambda: 'erased device'
mocked_async.return_value = apply_result
+ blkdev1 = hardware.BlockDevice('/dev/sdj', 'big', 1073741824, True)
+ blkdev2 = hardware.BlockDevice('/dev/hdaa', 'small', 65535, False)
self.hardware.list_block_devices = mock.Mock()
- self.hardware.list_block_devices.return_value = [
- hardware.BlockDevice('/dev/sdj', 'big', 1073741824, True),
- hardware.BlockDevice('/dev/hdaa', 'small', 65535, False),
- ]
+ self.hardware.list_block_devices.return_value = [blkdev1, blkdev2]
expected = {'/dev/hdaa': 'erased device', '/dev/sdj': 'erased device'}
result = self.hardware.erase_devices(self.node, [])
- self.assertTrue(mocked_async.called)
+ calls = [mock.call(mock.ANY, mocked_dispatch, ('erase_block_device',),
+ {'node': self.node, 'block_device': dev})
+ for dev in (blkdev1, blkdev2)]
+ mocked_async.assert_has_calls(calls)
self.assertEqual(expected, result)
@mock.patch.object(hardware, 'ThreadPool', autospec=True)