From 1ee5cbad39713772f256b87399e1e096c94a6923 Mon Sep 17 00:00:00 2001 From: Takashi NATSUME Date: Sat, 9 Dec 2017 14:04:34 +0900 Subject: [PATCH] [placement] Add sending global request ID in post Add the 'X-Openstack-Request-Id' header in the request of POST in SchedulerReportClient. When creating a resource provider and creating a resource class, the header is added. Subsequent patches will add the header in the other cases. Change-Id: I39d8c71432b3adf7e5bdde1c6cb6f089a9c79614 Partial-Bug: #1734625 --- .../api/openstack/placement/test_report_client.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nova/tests/functional/api/openstack/placement/test_report_client.py b/nova/tests/functional/api/openstack/placement/test_report_client.py index 88db65197..587476b8d 100644 --- a/nova/tests/functional/api/openstack/placement/test_report_client.py +++ b/nova/tests/functional/api/openstack/placement/test_report_client.py @@ -113,7 +113,7 @@ class SchedulerReportClientTests(test.TestCase): # But get_provider_tree_and_ensure_root creates one (via # _ensure_resource_provider) ptree = self.client.get_provider_tree_and_ensure_root( - self.compute_uuid) + self.context, self.compute_uuid) self.assertEqual([self.compute_uuid], ptree.get_provider_uuids()) # Now let's update status for our compute node. @@ -147,7 +147,7 @@ class SchedulerReportClientTests(test.TestCase): # Providers and inventory show up nicely in the provider tree ptree = self.client.get_provider_tree_and_ensure_root( - self.compute_uuid) + self.context, self.compute_uuid) self.assertEqual([self.compute_uuid], ptree.get_provider_uuids()) self.assertTrue(ptree.has_inventory(self.compute_uuid)) @@ -193,7 +193,7 @@ class SchedulerReportClientTests(test.TestCase): # Build the provider tree afresh. ptree = self.client.get_provider_tree_and_ensure_root( - self.compute_uuid) + self.context, self.compute_uuid) # The compute node is still there self.assertEqual([self.compute_uuid], ptree.get_provider_uuids()) # But the inventory is gone @@ -233,6 +233,11 @@ class SchedulerReportClientTests(test.TestCase): app=lambda: assert_app, url=self.url): self.client._delete_provider(self.compute_uuid, global_request_id=global_request_id) + payload = { + 'name': 'test-resource-provider' + } + self.client.post('/resource_providers', payload, + global_request_id=global_request_id) def test_get_provider_tree_with_nested_and_aggregates(self): """A more in-depth test of get_provider_tree_and_ensure_root with @@ -344,7 +349,7 @@ class SchedulerReportClientTests(test.TestCase): # Setup is done. Grab the ProviderTree prov_tree = self.client.get_provider_tree_and_ensure_root( - self.compute_uuid) + self.context, self.compute_uuid) # All providers show up because we used set_inventory_for_provider self.assertEqual(set([self.compute_uuid, uuids.ss1, uuids.ss2,