Logic in rest_client incorrect "resp.status=413"
rest_client is NOT redriving rate limited calls for the second time.
When 413 error code is encountered for a request, it checks for the
word "overLimit" and "limit" in resp_body and resp_body[message]
respectively so as to confirm if it is a absolute-limited call.
If absolute limited call is confirmed, OverLimit exception is raised
without any re-try for request.
Then comes the check for depth < MAX_RECURSION_DEPTH, if it is true,
re-drive towards request call occurs.
But, the word "limit" also appears in the message of ratelimited call.
Hence it is incorrect to raise OverLimit exception without re-try when
word "limit" is present in the message of response.
Thus changed the word to "exceeded" instead of "limit".
Fixes: bug #1093573
Change-Id: Iadd94c18668096d7e4795631337230ec36e9c4b9
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 884d147..c96fc4f 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -212,8 +212,8 @@
#TODO(afazekas): Make sure we can validate all responses, and the
#http library does not do any action automatically
if (resp.status in set((204, 205, 304)) or resp.status < 200 or
- method.upper() == 'HEAD') and resp_body:
- raise exceptions.ResponseWithNonEmptyBody(status=resp.status)
+ method.upper() == 'HEAD') and resp_body:
+ raise exceptions.ResponseWithNonEmptyBody(status=resp.status)
#NOTE(afazekas):
# If the HTTP Status Code is 205
@@ -226,8 +226,8 @@
if (resp.status == 205 and
0 != len(set(resp.keys()) - set(('status',)) -
- self.response_header_lc - self.general_header_lc)):
- raise exceptions.ResponseWithEntity()
+ self.response_header_lc - self.general_header_lc)):
+ raise exceptions.ResponseWithEntity()
#NOTE(afazekas)
# Now the swift sometimes (delete not empty container)
@@ -264,7 +264,7 @@
self._log(req_url, body, resp, resp_body)
if 'overLimit' in resp_body:
raise exceptions.OverLimit(resp_body['overLimit']['message'])
- elif 'limit' in resp_body['message']:
+ elif 'exceeded' in resp_body['message']:
raise exceptions.OverLimit(resp_body['message'])
elif depth < MAX_RECURSION_DEPTH:
delay = resp['Retry-After'] if 'Retry-After' in resp else 60