Wait correct exception (exceptions.NotFound) instead of any

except Exception as e -> except NotFound as e
(eliminate if hasattr(e, 'http_status') and e.http_status != 404)
Related-bug: #1609705

Change-Id: I460241206082a5476267c6388cbe3a04c969e60c
This commit is contained in:
Alexey Stepanov 2016-08-18 07:36:56 +03:00
parent 9027192108
commit e5b3a5feef
1 changed files with 7 additions and 12 deletions

View File

@ -18,6 +18,7 @@ import traceback
from devops.helpers import helpers from devops.helpers import helpers
from keystoneauth1.exceptions import HttpError from keystoneauth1.exceptions import HttpError
from keystoneauth1.exceptions import NotFound
import netaddr import netaddr
from proboscis import asserts from proboscis import asserts
from proboscis import test from proboscis import test
@ -298,18 +299,12 @@ class ServicesReconfiguration(TestBasic):
token = os_conn.keystone.tokens.authenticate(username='admin', token = os_conn.keystone.tokens.authenticate(username='admin',
password='admin') password='admin')
time.sleep(time_expiration) time.sleep(time_expiration)
try:
os_conn.keystone.tokens.validate(token.id) asserts.assert_raises(
except Exception as e: NotFound,
# TODO: Refactor HttpError in library (too much of copy-paste) os_conn.keystone.tokens.validate,
# pylint: disable=no-member (token.id, )
if hasattr(e, 'http_status') and e.http_status != 404: )
raise
# pylint: enable=no-member
logger.warning('Ignoring exception: {!r}'.format(e))
logger.debug(traceback.format_exc())
else:
raise Exception("New configuration was not applied")
@test(depends_on=[SetupEnvironment.prepare_slaves_5], @test(depends_on=[SetupEnvironment.prepare_slaves_5],
groups=["services_reconfiguration_thread_1", groups=["services_reconfiguration_thread_1",