-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move credential and header policies after retry policy #14629
Move credential and header policies after retry policy #14629
Conversation
/azp run python - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - can you please associate this with an issue
Could you please add a test for that change? |
It's going to be a little difficult to test these changes, I think the best way to test it is running the live tests pipeline |
/azp run python - storage - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
One idea is to inject a pipeline policy that simulates 5xx error. I know we do it in .NET and Java, in Python the closest thing I recall is this azure-sdk-for-python/sdk/storage/azure-storage-blob/tests/test_largest_block_blob.py Line 302 in 48ff819
Then if any of our auth policies supports credential rotation then we could rotate credential and assert that retry went with new cred. Example in .NET https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Common/tests/Shared/FaultyDownloadPipelinePolicy.cs |
This PR resolves #14701 and resolves #14067.
Case 1:
This case is related to the
StorageHeadersPolicy
. In the header policy thecurrent_time
is set. This policy is currently ran before the retry policy. This means that if the retry policy was retrying and the time period has exceeded 15 min difference between the pre-establishedcurrent_time
it would fail as it would be outdated.Solution Move the headers policy after
RetryPolicy
, i.e, current time would get reset with every retry.Case 2:
This case is related to the
StorageCredentialPolicy
, moving it after the retry policy means that theTokenCredential
can be refreshed if it has expired while retrying.