diff options
author | Sean Dague <sean@dague.net> | 2017-05-24 07:17:30 -0400 |
---|---|---|
committer | Erno Kuvaja <jokke@usr.fi> | 2017-06-01 14:32:03 +0000 |
commit | ec76e254da4f4727463dcb3a76adf33e5d3f7ffb (patch) | |
tree | 9f7c99bdf5731cf70995991fb0fba4fc5aa6fdd8 /glanceclient/tests/unit | |
parent | 03900522d4816fe5dc2958fa1eb30ab447cc8ee5 (diff) | |
download | python-glanceclient-ec76e254da4f4727463dcb3a76adf33e5d3f7ffb.tar.gz |
Allow global_request_id in Client constructor
This allows us to pass in a global_request_id in the client
constructor so that subsequent calls with this client pass that to the
servers. This enables cross project request_id tracking.
oslo spec I65de8261746b25d45e105394f4eeb95b9cb3bd42
Change-Id: Iea1e754a263a01dae5ed598fdda134394aff54b0
Diffstat (limited to 'glanceclient/tests/unit')
-rw-r--r-- | glanceclient/tests/unit/test_http.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/glanceclient/tests/unit/test_http.py b/glanceclient/tests/unit/test_http.py index ee82cf8..c57d5d4 100644 --- a/glanceclient/tests/unit/test_http.py +++ b/glanceclient/tests/unit/test_http.py @@ -15,6 +15,7 @@ import functools import json import logging +import uuid import fixtures from keystoneauth1 import session @@ -151,6 +152,18 @@ class TestClient(testtools.TestCase): headers = self.mock.last_request.headers self.assertEqual(kwargs['language_header'], headers['Accept-Language']) + def test_request_id_header_passed(self): + global_id = encodeutils.safe_encode("req-%s" % uuid.uuid4()) + kwargs = {'global_request_id': global_id} + http_client = http.HTTPClient(self.endpoint, **kwargs) + + path = '/v2/images/my-image' + self.mock.get(self.endpoint + path) + http_client.get(path) + + headers = self.mock.last_request.headers + self.assertEqual(global_id, headers['X-OpenStack-Request-ID']) + def test_language_header_not_passed_no_language(self): kwargs = {} http_client = http.HTTPClient(self.endpoint, **kwargs) |