Skip to content
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

Fix JDK HttpClient inclusion in testing #42070

Conversation

alzimmermsft
Copy link
Member

Description

Resolves an issue where JDK HttpClient would be on the classpath and HttpClient.createDefaultInstance() would crash an application during testing on Java 8. In a future release of azure-core this will be resolved with service provider loading catching certain errors that are related to class loading issues. So, a lot of this PR will be reverted when that change releases, but this is needed for now to resolve testing issues.

Note: azure-core-test has utility APIs which already handled these issues, but there are many locations in either test code or production code where an HttpClient isn't being configured, forcing those code paths to fallback to using HttpClient.createDefaultInstance(). These code paths should either be updated to using testing utilities that return the HttpClient implementation to use for testing or for production code those code paths should be updated to support configuring the HttpClient.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@alzimmermsft
Copy link
Member Author

/azp run java - azure-communication-identity - tests

@alzimmermsft
Copy link
Member Author

/azp run java - remoterendering - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@alzimmermsft
Copy link
Member Author

/azp run java - azure-communication-identity - tests

@alzimmermsft
Copy link
Member Author

/azp run java - remoterendering - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@alzimmermsft
Copy link
Member Author

/azp run java - azure-communication-identity - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@alzimmermsft
Copy link
Member Author

/check-enforcer override

@alzimmermsft alzimmermsft merged commit b51885f into Azure:main Sep 26, 2024
59 of 67 checks passed
@alzimmermsft alzimmermsft deleted the AzAll_ExcludeJdkHttpClientFromAzureCoreTest branch September 26, 2024 16:16
mssfang pushed a commit to mssfang/azure-sdk-for-java that referenced this pull request Oct 21, 2024
Fix JDK HttpClient inclusion in testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants