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
Conversation
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.
Pinging @elastic/es-core-infra (Team:Core/Infra) |
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) { |
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.
Note this is no longer necessary on master since Java 11 (and soon Java 17) is the minimum runtime version.
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.
LGTM.
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.
LGTM
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.