diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8fa356f3..deeb284819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Current ### Added: +- [Fix test failure due to daylight saving](https://github.com/yahoo/fili/pull/567) + * Time-checking based tests fails whenever Daylight saving turns on/off. Those tests are fixed by having a + daylight-saving flag that splits the checking to two versions of the time. + - [Have Table Endpoint Filter Using QueryPlanningConstraint](https://github.com/yahoo/fili/pull/439) * Enable tables endpoint to fiilter availabilities based on availability-constraint diff --git a/fili-sql/src/test/groovy/com/yahoo/bard/webservice/sql/DefaultSqlBackedClientSpec.groovy b/fili-sql/src/test/groovy/com/yahoo/bard/webservice/sql/DefaultSqlBackedClientSpec.groovy index cf19d8d561..7e200334ec 100644 --- a/fili-sql/src/test/groovy/com/yahoo/bard/webservice/sql/DefaultSqlBackedClientSpec.groovy +++ b/fili-sql/src/test/groovy/com/yahoo/bard/webservice/sql/DefaultSqlBackedClientSpec.groovy @@ -202,20 +202,24 @@ class DefaultSqlBackedClientSpec extends Specification { JsonNode jsonNode = sqlBackedClient.executeQuery(timeSeriesQuery, null, null).get() ResultSet parse = parse(jsonNode, timeSeriesQuery) + boolean daylightSaving = TimeZone.getTimeZone(timeZone).inDaylightTime(new Date()) + expect: - parse.size() == size - parse.get(0).getTimeStamp().toDateTime(timeZoneId).toString().contains(parsedResultText) - jsonNode.get(0).toString().contains(druidResultText) + parse.size() == (daylightSaving ? sizeDST : size) + parse.get(0).getTimeStamp().toDateTime(timeZoneId).toString().contains( + daylightSaving ? parsedResultTextDST : parsedResultText + ) + jsonNode.get(0).toString().contains(daylightSaving ? druidResultTextDST : druidResultText) where: - timeZone | timeGrain | size | parsedResultText | druidResultText - "America/Chicago" | MINUTE | 1394 | "2015-09-12T00:46:00.000" | "2015-09-12T05:46:00.000Z" - "America/Chicago" | HOUR | 24 | "2015-09-12T00:00:00.000" | "2015-09-12T05:00:00.000Z" - "America/Chicago" | DAY | 1 | "2015-09-12T00:00:00.000" | "2015-09-12T05:00:00.000Z" - "America/Chicago" | WEEK | 1 | "2015-09-07T00:00:00.000" | "2015-09-07T05:00:00.000Z" - "America/Chicago" | MONTH | 1 | "2015-09-01T00:00:00.000" | "2015-09-01T05:00:00.000Z" - "America/Chicago" | YEAR | 1 | "2015-01-01T00:00:00.000" | "2015-01-01T06:00:00.000Z" - "UTC" | YEAR | 1 | "2015-01-01T00:00:00.000" | "2015-01-01T00:00:00.000Z" + timeZone | timeGrain | sizeDST | size | parsedResultTextDST | druidResultTextDST | parsedResultText | druidResultText + "America/Chicago" | MINUTE | 1394 | 1380 | "2015-09-12T00:46:00.000" | "2015-09-12T05:46:00.000Z" | "2015-09-12T01:00:00.000" | "2015-09-12T06:00:00.000Z" + "America/Chicago" | HOUR | 24 | 23 | "2015-09-12T00:00:00.000" | "2015-09-12T05:00:00.000Z" | "2015-09-12T01:00:00.000" | "2015-09-12T06:00:00.000Z" + "America/Chicago" | DAY | 1 | 1 | "2015-09-12T00:00:00.000" | "2015-09-12T05:00:00.000Z" | "2015-09-12T00:00:00.000" | "2015-09-12T05:00:00.000Z" + "America/Chicago" | WEEK | 1 | 1 | "2015-09-07T00:00:00.000" | "2015-09-07T05:00:00.000Z" | "2015-09-07T00:00:00.000" | "2015-09-07T05:00:00.000Z" + "America/Chicago" | MONTH | 1 | 1 | "2015-09-01T00:00:00.000" | "2015-09-01T05:00:00.000Z" | "2015-09-01T00:00:00.000" | "2015-09-01T05:00:00.000Z" + "America/Chicago" | YEAR | 1 | 1 | "2015-01-01T00:00:00.000" | "2015-01-01T06:00:00.000Z" | "2015-01-01T00:00:00.000" | "2015-01-01T06:00:00.000Z" + "UTC" | YEAR | 1 | 1 | "2015-01-01T00:00:00.000" | "2015-01-01T00:00:00.000Z" | "2015-01-01T00:00:00.000" | "2015-01-01T00:00:00.000Z" } @Unroll