summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorCory Stone <corystone@gmail.com>2012-11-16 14:15:06 -0600
committerCory Stone <corystone@gmail.com>2013-01-07 14:57:27 -0600
commitdc8aeb49ce4ad6523e3f093fed082f78a6442814 (patch)
tree79c4f459a2dbe200dcb10c8125a52bf0740a8e0d /nova/tests
parente1c7b18c7f3c8d97ba7b2cccf27b968ad4710735 (diff)
Support cinderclient http retries.
HTTP retries were recently added to cinderclient. This adds the config option required to use it. The default (unchanged) behavior is 0 retries. Change-Id: Ia7ad831045e8df9ad9c22f0119ae3485d91ad949
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_cinder.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/nova/tests/test_cinder.py b/nova/tests/test_cinder.py
index dfdd4f3d7..7b1081b79 100644
--- a/nova/tests/test_cinder.py
+++ b/nova/tests/test_cinder.py
@@ -97,11 +97,14 @@ class FakeHTTPClient(cinder.cinder_client.client.HTTPClient):
class FakeCinderClient(cinder.cinder_client.Client):
- def __init__(self, username, password, project_id=None, auth_url=None):
+ def __init__(self, username, password, project_id=None, auth_url=None,
+ retries=None):
super(FakeCinderClient, self).__init__(username, password,
project_id=project_id,
- auth_url=auth_url)
- self.client = FakeHTTPClient(username, password, project_id, auth_url)
+ auth_url=auth_url,
+ retries=retries)
+ self.client = FakeHTTPClient(username, password, project_id, auth_url,
+ retries=retries)
# keep a ref to the clients callstack for factory's assert_called
self.callstack = self.client.callstack = []
@@ -173,3 +176,11 @@ class CinderTestCase(test.TestCase):
self.assert_called('GET', '/volumes/5678')
self.assertTrue('volume_image_metadata' in volume)
self.assertEqual(volume['volume_image_metadata'], _image_metadata)
+
+ def test_cinder_http_retries(self):
+ retries = 42
+ self.flags(cinder_http_retries=retries)
+ volume = self.api.get(self.context, '1234')
+ self.assert_called('GET', '/volumes/1234')
+ self.assertEquals(
+ self.fake_client_factory.client.client.retries, retries)