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

Remove use of Joda from test framework #78851

Merged
merged 3 commits into from Oct 11, 2021
Merged

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Oct 7, 2021

The test base class ESTestCase provides methods to get a random
timezone. It has methods for Joda, java.time and java.util timezones.
This commit reworks the test helper methods to no longer use Joda. Due
to backcompat tests for sql, the random timezones need to be limited to
those that are still useable by Joda. To filter the available timezones
not available in Joda, the unsupported timezone ids are hardcoded in
testcase initialization.

The test base class ESTestCase provides methods to get a random
timezone. It has methods for Joda, java.time and java.util timezones.
This commit reworks the test helper methods to no longer use Joda. Due
to backcompat tests for sql, the random timezones need to be limited to
those that are still useable by Joda. To filter the available timezones
not available in Joda, the unsupported timezone ids are hardcoded in
testcase initialization.
@rjernst rjernst added >test Issues or PRs that are addressing/adding tests :Core/Infra/Core Core issues without another label :Analytics/SQL SQL querying v8.0.0 labels Oct 7, 2021
@rjernst rjernst requested a review from pgomulka October 7, 2021 18:44
@elasticmachine elasticmachine added Team:QL (Deprecated) Meta label for query languages team Team:Core/Infra Meta label for core/infra team labels Oct 7, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

}

/**
* generate a random TimeZone from the ones available in java.time
*/
public static ZoneId randomZone() {
// work around a JDK bug, where java 8 cannot parse the timezone GMT0 back into a temporal accessor
// see https://bugs.openjdk.java.net/browse/JDK-8138664
if (JavaVersion.current().getVersion().get(0) == 8) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Note this is no longer necessary on master since Java 11 (and soon Java 17) is the minimum runtime version.

Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@pgomulka pgomulka left a comment

Choose a reason for hiding this comment

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

LGTM

@rjernst rjernst merged commit 61ed2e7 into elastic:master Oct 11, 2021
@rjernst rjernst deleted the joda/removal6 branch October 11, 2021 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/SQL SQL querying :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team Team:QL (Deprecated) Meta label for query languages team >test Issues or PRs that are addressing/adding tests v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants