Skip to content

Commit

Permalink
Fix test failure due to daylight saving
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Nov 7, 2017
1 parent 1b57d65 commit 1cd1d9a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1cd1d9a

Please sign in to comment.