Skip to content

Commit b2983d2

Browse files
authored
Remove the test which is testing java and joda api Backport(#41493) #41516
The test is testing the java time API and fails in case it hits daylight saving time changes. Java time has the right implementation and we don't need to test this. more details on how the test was affected by the DST change on this comment closes #39617 backport(#41493)
1 parent c3b6aaf commit b2983d2

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

server/src/test/java/org/elasticsearch/common/rounding/DateTimeUnitTests.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
package org.elasticsearch.common.rounding;
2020

2121
import org.elasticsearch.test.ESTestCase;
22-
import org.joda.time.DateTimeZone;
23-
24-
import java.time.Instant;
25-
import java.time.ZoneId;
26-
import java.time.ZonedDateTime;
2722

2823
import static org.elasticsearch.common.rounding.DateTimeUnit.DAY_OF_MONTH;
2924
import static org.elasticsearch.common.rounding.DateTimeUnit.HOUR_OF_DAY;
@@ -33,7 +28,6 @@
3328
import static org.elasticsearch.common.rounding.DateTimeUnit.SECOND_OF_MINUTE;
3429
import static org.elasticsearch.common.rounding.DateTimeUnit.WEEK_OF_WEEKYEAR;
3530
import static org.elasticsearch.common.rounding.DateTimeUnit.YEAR_OF_CENTURY;
36-
import static org.hamcrest.Matchers.is;
3731

3832
public class DateTimeUnitTests extends ESTestCase {
3933

@@ -65,17 +59,4 @@ public void testEnumIds() {
6559
assertEquals(8, SECOND_OF_MINUTE.id());
6660
assertEquals(SECOND_OF_MINUTE, DateTimeUnit.resolve((byte) 8));
6761
}
68-
69-
public void testConversion() {
70-
long millis = randomLongBetween(0, Instant.now().toEpochMilli());
71-
DateTimeZone zone = randomDateTimeZone();
72-
ZoneId zoneId = zone.toTimeZone().toZoneId();
73-
74-
int offsetSeconds = zoneId.getRules().getOffset(Instant.ofEpochMilli(millis)).getTotalSeconds();
75-
long parsedMillisJavaTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), zoneId)
76-
.minusSeconds(offsetSeconds).toInstant().toEpochMilli();
77-
78-
long parsedMillisJodaTime = zone.convertLocalToUTC(millis, true);
79-
assertThat(parsedMillisJavaTime, is(parsedMillisJodaTime));
80-
}
8162
}

0 commit comments

Comments
 (0)