From ee3ec9b8f2b0809fcd44a2f66b718ff1ee335ce3 Mon Sep 17 00:00:00 2001 From: Jay Faulkner Date: Tue, 9 Jul 2024 10:46:16 -0700 Subject: [PATCH] [ironic] Ensure we test iterators when needed Bug #2071972 brought it to light that we may have had some unit tests improperly operating against lists, when generators are used by the SDK. As a result of auditing remaining unit tests, this one instance was found of improper testing. Fixing this should avoid future bugs like 2071972. Related-Bug: #2071972 Change-Id: Icf9882f5f8421b150c308eb2502623f2fcb6cff6 --- nova/tests/unit/virt/ironic/test_driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/tests/unit/virt/ironic/test_driver.py b/nova/tests/unit/virt/ironic/test_driver.py index bf3291833d20..204ed522889d 100644 --- a/nova/tests/unit/virt/ironic/test_driver.py +++ b/nova/tests/unit/virt/ironic/test_driver.py @@ -1093,7 +1093,7 @@ class IronicDriverTestCase(test.NoDBTestCase): fake_resource = 'fake-resource' self.mock_conn.get_node.return_value = node # ensure cache gets populated without the node we want - self.mock_conn.nodes.return_value = [node_2] + self.mock_conn.nodes.return_value = iter([node_2]) mock_nr.return_value = fake_resource result = self.driver.get_available_resource(node.id)