From 9a6c61015c1ac91e5ba7e826f3d63d2ecd9263bd Mon Sep 17 00:00:00 2001 From: Andrei Stefan Date: Mon, 31 Dec 2018 13:41:54 +0200 Subject: [PATCH] Use the same format when comparing the error messages containing date fields (#37006) Test fix: make sure the format in which we check the date is the same as the one we used to format the initial JDBC date field. --- .../org/elasticsearch/xpack/sql/qa/jdbc/JdbcTestUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcTestUtils.java b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcTestUtils.java index becb76f4e0e..9d1b68a92f4 100644 --- a/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcTestUtils.java +++ b/x-pack/plugin/sql/qa/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcTestUtils.java @@ -8,6 +8,7 @@ package org.elasticsearch.xpack.sql.qa.jdbc; import org.apache.logging.log4j.Logger; import org.elasticsearch.xpack.sql.action.CliFormatter; import org.elasticsearch.xpack.sql.proto.ColumnInfo; +import org.elasticsearch.xpack.sql.proto.StringUtils; import java.sql.ResultSet; import java.sql.ResultSetMetaData; @@ -134,7 +135,7 @@ public abstract class JdbcTestUtils { logger.info("\n" + formatter.formatWithHeader(cols, data)); } - public static ZonedDateTime of(long millis) { - return ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC); + public static String of(long millis) { + return StringUtils.toString(ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC)); } } \ No newline at end of file