Make functests retry auth immediately
I don't think we need to backoff after a 401 - we have a perfectly valid response telling us exactly what we should do so we can do that right away and move on. Assuming you run functional tests at least once a day, according to http://xkcd.com/1205/ and my benchmarks you can spend roughly a full day reviewing this change and still come out ahead. Change-Id: I27c42c4ee3254eb32aad4d3dac08b16b3a43d611
This commit is contained in:
parent
e3cbfc5c5e
commit
555e9894ee
@ -625,6 +625,7 @@ def retry(func, *args, **kwargs):
|
||||
os_options = {'user_domain_name': swift_test_domain[use_account],
|
||||
'project_domain_name': swift_test_domain[use_account]}
|
||||
while attempts <= retries:
|
||||
auth_failure = False
|
||||
attempts += 1
|
||||
try:
|
||||
if not url[use_account] or not token[use_account]:
|
||||
@ -654,13 +655,15 @@ def retry(func, *args, **kwargs):
|
||||
if service_user:
|
||||
service_token[service_user] = None
|
||||
except AuthError:
|
||||
auth_failure = True
|
||||
url[use_account] = token[use_account] = None
|
||||
if service_user:
|
||||
service_token[service_user] = None
|
||||
except InternalServerError:
|
||||
pass
|
||||
if attempts <= retries:
|
||||
sleep(backoff)
|
||||
if not auth_failure:
|
||||
sleep(backoff)
|
||||
backoff *= 2
|
||||
raise Exception('No result after %s retries.' % retries)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user