Skip to content

Commit

Permalink
[Test] Consistent datetime formatting for java and joda time (#66914) (
Browse files Browse the repository at this point in the history
…#66974)

This PR fixes the test failure by ensuring consistent datetime formatting
between java DateTimeFormatter and joda time.
  • Loading branch information
ywangd committed Jan 5, 2021
1 parent dae36e4 commit cb041c7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ public void testExpression_EscapeDateFormat() throws Exception {

public void testExpression_MixedArray() throws Exception {
List<String> result = expressionResolver.resolve(context, Arrays.asList(
"name1", "<.marvel-{now/d}>", "name2", "<.logstash-{now/M{YYYY.MM}}>"
"name1", "<.marvel-{now/d}>", "name2", "<.logstash-{now/M{uuuu.MM}}>"
));
assertThat(result.size(), equalTo(4));
assertThat(result.get(0), equalTo("name1"));
assertThat(result.get(1),
equalTo(".marvel-" + DateTimeFormat.forPattern("YYYY.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
equalTo(".marvel-" + DateTimeFormat.forPattern("yyyy.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
assertThat(result.get(2), equalTo("name2"));
assertThat(result.get(3), equalTo(".logstash-" +
DateTimeFormat.forPattern("YYYY.MM").print(new DateTime(context.getStartTime(), UTC).withDayOfMonth(1))));
DateTimeFormat.forPattern("yyyy.MM").print(new DateTime(context.getStartTime(), UTC).withDayOfMonth(1))));
}

public void testExpression_CustomTimeZoneInIndexName() throws Exception {
Expand Down

0 comments on commit cb041c7

Please sign in to comment.