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

Add an integration test that runs on JDK-8 #795

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

reta
Copy link
Collaborator

@reta reta commented Jan 2, 2024

Description

Add an integration test that runs on JDK-8

Issues Resolved

Closes #778

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@reta reta force-pushed the issue-778 branch 2 times, most recently from 6cbd85f to e785ec3 Compare January 2, 2024 20:27
@reta reta marked this pull request as ready for review January 2, 2024 21:07
@@ -369,5 +372,17 @@ if (JavaVersion.current() >= JavaVersion.VERSION_11) {
testClassesDirs += java11.output.classesDirs
classpath = sourceSets["java11"].runtimeClasspath
}

} else if (jdk8compatibility == true) {
java {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dblock @VachaShah curious what you think about this approach: we cannot run Gradle build using JDK-8 but we could use toolchains to run tests under JDK-8.

if (JavaVersion.current() >= JavaVersion.VERSION_11) {
// Use `-Pcheck-jdk8-compatibility=true` to
val jdk8compatibility = (project.findProperty("check-jdk8-compatibility") as String?).toBoolean()
if (JavaVersion.current() >= JavaVersion.VERSION_11 && jdk8compatibility == false) {
Copy link
Member

@dblock dblock Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dislike the whole check-jdk8-compatibility=true business. Why do we need this at all and not just this?

if (JavaVersion.current() >= JavaVersion.VERSION_11) {
 ...
} else if (JavaVersion.current() >= JavaVersion.VERSION_8) {
 ...
}

Copy link
Collaborator Author

@reta reta Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That the thing, the JavaVersion.current() is the version Gradle run with, it is always 11 or higher. I will try to experiment with toolchains here (alternatively, we could make all tests JDK-8 compatible and that would eliminate the conditional part)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see.

Maybe we could improve on this by introducing optional JAVA_TOOLCHAIN_VERSION and default it to 11. Basically avoiding this whole if logic?

Stepping back, this does seem to work, so we should merge it and improve it later if you can't come up with something a lot nicer. Leave some TODOs with an explanation at the least?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea, thanks @dblock , I refactored it to use similar to OpenSearch core approach with runtime.java version.

@reta reta force-pushed the issue-778 branch 2 times, most recently from 0c157de to 40ee090 Compare January 3, 2024 16:22
dblock
dblock previously approved these changes Jan 3, 2024
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, nice and clean!

@reta reta force-pushed the issue-778 branch 3 times, most recently from 9e7fbc1 to 74282dd Compare January 3, 2024 17:05
@reta
Copy link
Collaborator Author

reta commented Jan 3, 2024

Perfect, nice and clean!

As always, Windows have troubles with env variables that have dots

@reta reta requested a review from dblock January 3, 2024 17:15
@dblock dblock merged commit f8ec75e into opensearch-project:main Jan 3, 2024
49 checks passed
@dblock dblock added the backport 2.x Backport to 2.x branch label Jan 3, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 3, 2024
* Add an integration test that runs on JDK-8

Signed-off-by: Andriy Redko <[email protected]>

* Refactor the runtime Java selection

Signed-off-by: Andriy Redko <[email protected]>

---------

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit f8ec75e)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
reta pushed a commit that referenced this pull request Jan 3, 2024
* Add an integration test that runs on JDK-8

Signed-off-by: Andriy Redko <[email protected]>

* Refactor the runtime Java selection

Signed-off-by: Andriy Redko <[email protected]>

---------

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit f8ec75e)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Andriy Redko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add an integration test that runs on JDK8
2 participants