Skip to content

Commit

Permalink
Fix date math zone test to use negative minutes (#78796)
Browse files Browse the repository at this point in the history
Joda classes for timezones accepted positive minutes when a negative
hours was used, but Java time expects negative minutes when negative
hours are used. This commit fixes tests to ensure negative minutes are
used with negative hours.

closes #78783
  • Loading branch information
rjernst authored Oct 6, 2021
1 parent 4df15f5 commit d85195b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public void testExpression_MixedArray() throws Exception {
assertThat(result.get(3), equalTo(".logstash-" +
formatDate("uuuu.MM", dateFromMillis(context.getStartTime()).withDayOfMonth(1))));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/78783")

public void testExpression_CustomTimeZoneInIndexName() throws Exception {
ZoneId timeZone;
int hoursOffset;
Expand All @@ -138,6 +137,9 @@ public void testExpression_CustomTimeZoneInIndexName() throws Exception {
} else {
hoursOffset = randomIntBetween(-11, 13);
minutesOffset = randomIntBetween(0, 59);
if (hoursOffset < 0) {
minutesOffset = -minutesOffset;
}
timeZone = ZoneOffset.ofHoursMinutes(hoursOffset, minutesOffset);
}
ZonedDateTime now;
Expand Down

0 comments on commit d85195b

Please sign in to comment.