Merge "Use cached auth_ref instead of gettin a new one each time"

This commit is contained in:
Zuul 2017-11-29 15:54:41 +00:00 committed by Gerrit Code Review
commit bc6c123c1c
2 changed files with 3 additions and 4 deletions

View File

@ -80,8 +80,7 @@ class SwiftConnectionManager(object):
# connection manager users. Also we disable re-authentication
# if there is not way to execute it (cannot initialize trusts for
# multi-tenant or auth_version is not 3)
auth_ref = self.client.session.auth.get_auth_ref(
self.client.session)
auth_ref = self.client.session.auth.auth_ref
# if connection token is going to expire soon (keystone checks
# is token is going to expire or expired already)
if auth_ref.will_expire_soon(

View File

@ -107,7 +107,7 @@ class TestConnectionManager(base.StoreBaseTest):
self.context)
# return the same connection because it should not be expired
auth_ref = mock.MagicMock()
self.client.session.auth.get_auth_ref.return_value = auth_ref
self.client.session.auth.auth_ref = auth_ref
auth_ref.will_expire_soon.return_value = False
manager.get_connection()
# check that we don't update connection
@ -149,7 +149,7 @@ class TestConnectionManager(base.StoreBaseTest):
)
# return the same connection because it should not be expired
auth_ref = mock.MagicMock()
self.client.session.auth.get_auth_ref.return_value = auth_ref
self.client.session.auth.auth_ref = auth_ref
auth_ref.will_expire_soon.return_value = False
manager.get_connection()
# check that we don't update connection