summaryrefslogtreecommitdiff
path: root/nova/tests
diff options
context:
space:
mode:
authorSean Dague <sean@dague.net>2017-05-26 06:46:00 -0400
committerSean Dague <sean@dague.net>2017-06-05 10:15:20 -0400
commit9189d9be88a7a236336a193371c140c943087b7e (patch)
tree98100ed2301fc8dc8a98a1ddcafccb67cd89d239 /nova/tests
parent6b383444963f65079d01bfec6c1c18ada51c9e64 (diff)
downloadnova-9189d9be88a7a236336a193371c140c943087b7e.tar.gz
Send request_id on glance calls
This changes the constructor so that glance calls will carry forward the request_id to the glance service. ``global_id`` is a magic property on new oslo.context which is either set to the global_request_id sent into Nova, or the local request id if it's not set. Fix some unit tests to handle this new parameter when mocking glanceclient calls. oslo spec I65de8261746b25d45e105394f4eeb95b9cb3bd42 Change-Id: I16f9dda3c904c4a2578fa6a691fed646a41f6793
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/unit/image/test_glance.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/nova/tests/unit/image/test_glance.py b/nova/tests/unit/image/test_glance.py
index 6993247bc3..e6b87a9220 100644
--- a/nova/tests/unit/image/test_glance.py
+++ b/nova/tests/unit/image/test_glance.py
@@ -353,8 +353,9 @@ class TestCreateGlanceClient(test.NoDBTestCase):
'X-User-Id': 'fake',
'X-Roles': '',
'X-Tenant-Id': 'fake',
- 'X-Identity-Status': 'Confirmed'
- }
+ 'X-Identity-Status': 'Confirmed',
+ },
+ 'global_request_id': mock.ANY
}
glance._glanceclient_from_endpoint(ctx, expected_endpoint, 2)
init_mock.assert_called_once_with('2', expected_endpoint,
@@ -370,8 +371,9 @@ class TestCreateGlanceClient(test.NoDBTestCase):
'X-User-Id': 'fake',
'X-Roles': '',
'X-Tenant-Id': 'fake',
- 'X-Identity-Status': 'Confirmed'
- }
+ 'X-Identity-Status': 'Confirmed',
+ },
+ 'global_request_id': mock.ANY
}
glance._glanceclient_from_endpoint(ctx, expected_endpoint, 2)
init_mock.assert_called_once_with('2', expected_endpoint,
@@ -511,10 +513,11 @@ class TestGlanceClientWrapper(test.NoDBTestCase):
ssl_enable_mock):
self.flags(ca_file='foo.cert', cert_file='bar.cert',
key_file='wut.key', group='ssl')
- ctxt = mock.sentinel.ctx
+ ctxt = mock.MagicMock()
glance._glanceclient_from_endpoint(ctxt, 'https://host4:9295', 2)
client_mock.assert_called_once_with(
- '2', 'https://host4:9295', insecure=False, ssl_compression=False,
+ '2', 'https://host4:9295', global_request_id=mock.ANY,
+ insecure=False, ssl_compression=False,
cert_file='bar.cert', key_file='wut.key', cacert='foo.cert',
identity_headers=mock.ANY)