-
Notifications
You must be signed in to change notification settings - Fork 569
[DO NOT REVIEW YET] Fix for e2e transient auth failures #5275
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
Open
jestradaMS
wants to merge
3
commits into
main
Choose a base branch
from
users/jestrada/fixe2etestauthfailures
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ion failures and add warmup checks
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces a robust mechanism for handling transient authentication failures during E2E test initialization by adding retry logic for 401 Unauthorized responses. The changes wrap the existing authentication flow with new components that can invalidate cached tokens and automatically retry failed requests, significantly improving test reliability when token acquisition is flaky. The main changes are grouped as follows:
Authentication Retry Mechanism:
RetryableCredentialProvider, a wrapper aroundICredentialProviderthat allows invalidating cached tokens and ensures fresh tokens are acquired after failures. (RetryableCredentialProvider.cs,TestFhirServer.cs) [1] [2] [3] [4] [5]RetryAuthenticationHttpMessageHandler, a delegating handler that retries HTTP requests on 401 responses with exponential backoff, invalidating tokens as needed. (RetryAuthenticationHttpMessageHandler.cs,TestFhirServer.cs) [1] [2] [3] [4] [5] [6]TestFhirServerto use these new handlers and providers for authentication, replacing the previous direct use ofAuthenticationHttpMessageHandler. (TestFhirServer.cs,TestFhirClient.cs) [1] [2] [3] [4] [5]Error Handling Improvements:
AuthenticationWarmupException, a custom exception to fail the entire test suite quickly if authentication warmup fails, avoiding hundreds of redundant test failures. (AuthenticationWarmupException.cs)Project Structure and Typing:
Microsoft.Health.Fhir.Shared.Tests.E2E.projitems)HttpMessageHandlerinstead of the specificAuthenticationHttpMessageHandler, increasing flexibility. (TestFhirClient.cs,TestFhirServer.cs) [1] [2] [3] [4]These changes collectively make the E2E test suite more resilient to transient authentication issues and easier to maintain.
Related issues
Addresses [issue #].
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)