From 555e9894eee58fb49ac66ae703aa2835beedbe0c Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Thu, 26 Feb 2015 12:30:30 -0800 Subject: [PATCH] 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 --- test/functional/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/functional/__init__.py b/test/functional/__init__.py index 5ad204b9be..c4d7642680 100644 --- a/test/functional/__init__.py +++ b/test/functional/__init__.py @@ -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)