-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Cleanup JDK provider in tests #26891
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
Conversation
Reviewer's GuideThis PR simplifies JDK handling by removing legacy built-in and custom distribution providers, unifying downloads to use Temurin across both Docker build scripts and the product tests launcher. Flow diagram for unified Temurin JDK download in Docker build scriptflowchart TD
A["Read Temurin release from .temurin-release"] --> B["Select architecture (arm64, amd64, ppc64le)"]
B --> C["Generate Temurin download URL"]
C --> D["Pass JDK download link to docker build"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes - here's some feedback:
- In build.sh, add a check to ensure TEMURIN_RELEASE (and the .temurin-release file) is present and non‐empty before attempting to build images to avoid silent failures.
- Add unit tests for TemurinJdkProvider#getDownloadUri to assert that it generates the correct download URLs for each supported architecture.
- Consider consolidating the architecture‐to‐name mappings (aarch64/x64/ppc64le) into a shared utility or config to avoid duplicating the logic in both the shell script and Java provider.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In build.sh, add a check to ensure TEMURIN_RELEASE (and the .temurin-release file) is present and non‐empty before attempting to build images to avoid silent failures.
- Add unit tests for TemurinJdkProvider#getDownloadUri to assert that it generates the correct download URLs for each supported architecture.
- Consider consolidating the architecture‐to‐name mappings (aarch64/x64/ppc64le) into a shared utility or config to avoid duplicating the logic in both the shell script and Java provider.
## Individual Comments
### Comment 1
<location> `testing/trino-product-tests-launcher/src/test/java/io/trino/tests/product/launcher/env/TestConfigurations.java:64` </location>
<code_context>
public void testJdkProviderName()
{
- assertThat(nameForJdkProviderName(BuiltInJdkProvider.class)).isEqualTo("builtin");
+ assertThat(nameForJdkProviderName(TemurinJdkProvider.class)).isEqualTo("temurin");
assertThat(canonicalJdkProviderName("BuiltIN")).isEqualTo("builtin");
assertThat(canonicalJdkProviderName("built-IN")).isEqualTo("builtin");
</code_context>
<issue_to_address>
**suggestion (testing):** Missing tests for TemurinJdkProvider edge cases and error handling.
Please add tests for invalid release names, null download paths, and unsupported architectures to improve coverage of error handling.
Suggested implementation:
```java
@Test
public void testJdkProviderName()
{
assertThat(nameForJdkProviderName(TemurinJdkProvider.class)).isEqualTo("temurin");
assertThat(canonicalJdkProviderName("BuiltIN")).isEqualTo("builtin");
assertThat(canonicalJdkProviderName("built-IN")).isEqualTo("builtin");
}
@Test
public void testTemurinJdkProviderInvalidReleaseName()
{
TemurinJdkProvider provider = new TemurinJdkProvider();
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
provider.getDownloadUrl("invalid-release", "linux-x64");
});
assertThat(exception.getMessage()).contains("Invalid release name");
}
@Test
public void testTemurinJdkProviderNullDownloadPath()
{
TemurinJdkProvider provider = new TemurinJdkProvider();
Exception exception = assertThrows(NullPointerException.class, () -> {
provider.getDownloadUrl(null, "linux-x64");
});
assertThat(exception.getMessage()).contains("release name is null");
}
@Test
public void testTemurinJdkProviderUnsupportedArchitecture()
{
TemurinJdkProvider provider = new TemurinJdkProvider();
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
provider.getDownloadUrl("17", "unsupported-arch");
});
assertThat(exception.getMessage()).contains("Unsupported architecture");
}
```
- Ensure that TemurinJdkProvider#getDownloadUrl(String release, String arch) throws appropriate exceptions for invalid release names, null release names, and unsupported architectures.
- If the method signatures or exception messages differ, adjust the test cases accordingly.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
...uct-tests-launcher/src/test/java/io/trino/tests/product/launcher/env/TestConfigurations.java
Show resolved
Hide resolved
|
This makes it easier to forward test new JDK version (and upgrade these too) |
We only use Temurin for both testing and while producing docker images so there is no point in keeping more complicated implementation if it's not used.
0449f86 to
041dc20
Compare
We only use Temurin for both testing and while producing docker images so there is no point in keeping more complicated implementation if it's not used.
Description
Additional context and related issues
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:
Summary by Sourcery
Switch JDK provisioning to use Temurin exclusively and remove legacy JDK provider logic
New Features:
Enhancements:
Tests:
Chores: