Skip to content

Commit 0b647c5

Browse files
authored
Fix perf tests (Azure#20201)
1 parent 7bf3621 commit 0b647c5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

sdk/identity/azure-identity/azure/identity/_persistent_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def _get_persistence(allow_unencrypted, account_name, cache_name):
9090
if not allow_unencrypted:
9191
raise ValueError(
9292
"PyGObject is required to encrypt the persistent cache. Please install that library or "
93-
+ 'specify "allow_unencrypted_cache=True" to store the cache without encryption.'
93+
+ 'specify "allow_unencrypted_storage=True" to store the cache without encryption.'
9494
)
9595
return msal_extensions.FilePersistence(file_path)
9696

sdk/identity/azure-identity/tests/perfstress_tests/bearer_token_auth_policy.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ def __init__(self, arguments):
2626
credential = Mock(get_token=Mock(return_value=token))
2727
self.pipeline = Pipeline(transport=Mock(), policies=[BearerTokenCredentialPolicy(credential=credential)])
2828

29-
completed_future = asyncio.Future()
30-
completed_future.set_result(token)
31-
async_credential = Mock(get_token=Mock(return_value=completed_future))
29+
get_token_future = asyncio.Future()
30+
get_token_future.set_result(token)
31+
async_credential = Mock(get_token=Mock(return_value=get_token_future))
3232

33-
# returning a token is okay because the policy does nothing with the transport's response
34-
async_transport = Mock(send=Mock(return_value=completed_future))
33+
send_future = asyncio.Future()
34+
send_future.set_result(Mock())
35+
async_transport = Mock(send=Mock(return_value=send_future))
3536
self.async_pipeline = AsyncPipeline(
3637
async_transport, policies=[AsyncBearerTokenCredentialPolicy(credential=async_credential)]
3738
)

sdk/identity/azure-identity/tests/perfstress_tests/persistent_cache_read.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ def __init__(self, arguments):
2222
client_id = self.get_from_env("AZURE_CLIENT_ID")
2323
tenant_id = self.get_from_env("AZURE_TENANT_ID")
2424
secret = self.get_from_env("AZURE_CLIENT_SECRET")
25-
self.credential = ClientSecretCredential(
26-
tenant_id, client_id, secret, cache_persistence_options=TokenCachePersistenceOptions()
27-
)
25+
cache_options = TokenCachePersistenceOptions(allow_unencrypted_storage=True)
26+
self.credential = ClientSecretCredential(tenant_id, client_id, secret, cache_persistence_options=cache_options)
2827
self.async_credential = AsyncClientSecretCredential(
29-
tenant_id, client_id, secret, cache_persistence_options=TokenCachePersistenceOptions()
28+
tenant_id, client_id, secret, cache_persistence_options=cache_options
3029
)
3130
self.scope = "https://vault.azure.net/.default"
3231

0 commit comments

Comments
 (0)