Skip to content

Commit

Permalink
test: improve tz test coverage (#3549)
Browse files Browse the repository at this point in the history
* test: improve tz test coverage
  • Loading branch information
big-andy-coates authored Oct 14, 2019
1 parent 2be8385 commit 99136af
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private static void validateTopicData(
final boolean ranWithInsertStatements
) {
if (actual.size() != expected.size()) {
throw new KsqlException("Expected <" + expected.size()
throw new KsqlException("Topic " + topicName + ". Expected <" + expected.size()
+ "> records but it was <" + actual.size() + ">\n" + getActualsForErrorMessage(actual));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"comments": [
"Tests covering the use of the TIMESTAMPTOSTRING function."
],
"tests": [
{
"name": "with valid zone",
"statements": [
"CREATE STREAM INPUT (IGNORED INT) WITH (kafka_topic='input', value_format='JSON');",
"CREATE STREAM OUTPUT AS SELECT TIMESTAMPTOSTRING(ROWTIME, 'yyyy-MM-dd HH:mm:ss zzz','America/Los_Angeles') FROM input;"
],
"inputs": [
{"topic": "input", "value": {}, "timestamp": 1526075913000}
],
"outputs": [
{"topic": "OUTPUT", "value": {"KSQL_COL_0":"2018-05-11 14:58:33 PDT"}, "timestamp": 1526075913000}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,28 @@
"CREATE STREAM TS AS select id, stringtotimestamp(event_timestamp, 'yyyy-MM-dd''T''HH:mm:ssX') as ets from test;"
],
"inputs": [
{"topic": "test_topic", "value": {"ID": 1, "event_timestamp": "2018-05-11T21:58:33Z"}, "timestamp": 1526075913000},
{"topic": "test_topic", "value": {"ID": 1, "event_timestamp": "2019-05-11T21:58:33Z"}, "timestamp": 1557611913000},
{"topic": "test_topic", "value": {"ID": 1, "event_timestamp": "2020-05-11T21:58:33Z"}, "timestamp": 1589234313000}
{"topic": "test_topic", "value": {"ID": 1, "event_timestamp": "2018-05-11T21:58:33Z"}, "timestamp": 10},
{"topic": "test_topic", "value": {"ID": 1, "event_timestamp": "2019-05-11T21:58:33Z"}, "timestamp": 10},
{"topic": "test_topic", "value": {"ID": 1, "event_timestamp": "2020-05-11T21:58:33Z"}, "timestamp": 10}
],
"outputs": [
{"topic": "TS", "value": {"ID": 1, "ETS": 1526075913000}, "timestamp": 1526075913000},
{"topic": "TS", "value": {"ID": 1, "ETS": 1557611913000}, "timestamp": 1557611913000},
{"topic": "TS", "value": {"ID": 1, "ETS": 1589234313000}, "timestamp": 1589234313000}
]
},
{
"name": "with single digit ms and numeric tz",
"statements": [
"CREATE STREAM TEST (event_timestamp VARCHAR) WITH (kafka_topic='test_topic', value_format='JSON', timestamp='event_timestamp', timestamp_format='yyyy-MM-dd''T''HH:mm:ss.SX');",
"CREATE STREAM TS AS select stringtotimestamp(event_timestamp, 'yyyy-MM-dd''T''HH:mm:ss.SX') as ets from test;"
],
"inputs": [
{"topic": "test_topic", "value": {"event_timestamp": "2019-08-27T13:31:09.2+0000"}, "timestamp": 10}
],
"outputs": [
{"topic": "TS", "value": {"ETS": 1566912669200}, "timestamp": 1566912669200}
]
}
]
}
Expand Down

0 comments on commit 99136af

Please sign in to comment.