From d85195b6bf861f07dd5071ddff4048045be88623 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 6 Oct 2021 15:37:52 -0700 Subject: [PATCH] Fix date math zone test to use negative minutes (#78796) 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 --- .../cluster/metadata/DateMathExpressionResolverTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/DateMathExpressionResolverTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/DateMathExpressionResolverTests.java index 698464b718bde..41161d60486f2 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/DateMathExpressionResolverTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/DateMathExpressionResolverTests.java @@ -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; @@ -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;