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:
Clay Gerrard 2015-02-26 12:30:30 -08:00
parent e3cbfc5c5e
commit 555e9894ee

View File

@ -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)