Skip to content

Commit

Permalink
Fix date math zone test to use negative minutes
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 elastic#78783
  • Loading branch information
rjernst committed Oct 6, 2021
1 parent 548bd30 commit 858a82b
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 858a82b

Please sign in to comment.