summaryrefslogtreecommitdiff
path: root/nova/tests/unit/scheduler/client
diff options
context:
space:
mode:
authorEric Fried <efried@us.ibm.com>2018-01-22 15:53:04 -0600
committerEric Fried <efried@us.ibm.com>2018-01-31 08:35:35 -0600
commit8014449f2ce3a89aedbd7c4abc072a3349a58c08 (patch)
treecae0a902d6674e43a952849cd11f4631af95a692 /nova/tests/unit/scheduler/client
parente3de95e3b31aed93c8ea140c3382c9bc8f8d4127 (diff)
downloadnova-8014449f2ce3a89aedbd7c4abc072a3349a58c08.tar.gz
ProviderTree.get_provider_uuids: Top-down ordering
It will become important in update_from_provider_tree to be able to walk the providers in a ProviderTree in a sane and predictable order. Otherwise, when flushing multiple adds/deletes, we will have no reliable way to avoid creating orphans (which will fail). Here we change ProviderTree.get_provider_uuids from returning a set() to returning a list which is guaranteed to be in top-down order. We do not guarantee the order in which siblings appear, or where nephews appear relative to their uncles; just that a child will always appear after its parent (and, by extension, after all its ancestors). Change-Id: I2fb691e019177c502ec651390faf3740a2d49045 blueprint: nested-resource-providers
Diffstat (limited to 'nova/tests/unit/scheduler/client')
-rw-r--r--nova/tests/unit/scheduler/client/test_report.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py
index 4cd43afa4c..e3c3d1e619 100644
--- a/nova/tests/unit/scheduler/client/test_report.py
+++ b/nova/tests/unit/scheduler/client/test_report.py
@@ -1421,7 +1421,7 @@ class TestProviderOperations(SchedulerReportClientTestCase):
# At this point we should get all the providers.
self.assertEqual(
set([uuids.root, uuids.child1, uuids.child2, uuids.grandchild]),
- self.client._provider_tree.get_provider_uuids())
+ set(self.client._provider_tree.get_provider_uuids()))
@mock.patch('nova.compute.provider_tree.ProviderTree.exists')
@mock.patch('nova.compute.provider_tree.ProviderTree.get_provider_uuids')
@@ -1461,7 +1461,7 @@ class TestProviderOperations(SchedulerReportClientTestCase):
[mock.call(uuid, generation=42, force=True)
for uuid in tree_uuids])
self.assertEqual(tree_uuids,
- self.client._provider_tree.get_provider_uuids())
+ set(self.client._provider_tree.get_provider_uuids()))
@mock.patch('nova.scheduler.client.report.SchedulerReportClient.'
'_get_providers_in_tree')
@@ -1481,7 +1481,7 @@ class TestProviderOperations(SchedulerReportClientTestCase):
mock_create.assert_called_once_with(uuids.root, uuids.root,
parent_provider_uuid=None)
mock_refresh.assert_not_called()
- self.assertEqual(set([uuids.cn]),
+ self.assertEqual([uuids.cn],
self.client._provider_tree.get_provider_uuids())
def test_get_allocation_candidates(self):