Sfoglia il codice sorgente

Tests: Fix timezone conversion in DateTimeUnitTests

This fix prevernts trying to parse unknown timezone ids by converting
the joda time zone via java.util.TimeZone to a java time based ZoneId.

Closes #32927
Alexander Reelsen 7 anni fa
parent
commit
0d92f377fd

+ 1 - 1
server/src/test/java/org/elasticsearch/common/rounding/DateTimeUnitTests.java

@@ -69,7 +69,7 @@ public class DateTimeUnitTests extends ESTestCase {
     public void testConversion() {
         long millis = randomLongBetween(0, Instant.now().toEpochMilli());
         DateTimeZone zone = randomDateTimeZone();
-        ZoneId zoneId = ZoneId.of(zone.getID());
+        ZoneId zoneId = zone.toTimeZone().toZoneId();
 
         int offsetSeconds = zoneId.getRules().getOffset(Instant.ofEpochMilli(millis)).getTotalSeconds();
         long parsedMillisJavaTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), zoneId)