Skip to content

Commit ec3572e

Browse files
authored
Add mutation canary test job (#114)
1 parent eeb38e9 commit ec3572e

11 files changed

Lines changed: 191 additions & 0 deletions

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ jobs:
139139
compile aggregation-query-test-iceberg-package.json
140140
compile aggregation-query-subscription-test-package.json
141141
142+
- example: canary-mutation
143+
path: test-jobs/mutation-tests
144+
tag: canary
145+
test_commands: |
146+
compile mutation-test-package.json
147+
142148
- example: canary-failures
143149
path: test-jobs/failure-tests
144150
tag: canary
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "1",
3+
"enabled-engines": ["vertx", "postgres", "kafka", "flink"],
4+
"script": {
5+
"main": "sensors.sqrl"
6+
},
7+
"engines": {
8+
"flink" : {
9+
"config" : {
10+
"table.exec.source.idle-timeout": "5s"
11+
}
12+
}
13+
},
14+
"test-runner": {
15+
"delay-sec": 30,
16+
"mutation-delay-sec": 1
17+
}
18+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*+ engine(kafka) */
2+
CREATE TABLE SensorReading (
3+
sensor_id INT NOT NULL,
4+
temperature FLOAT NOT NULL,
5+
placement STRING NOT NULL,
6+
event_time TIMESTAMP_LTZ(3) NOT NULL METADATA FROM 'timestamp'
7+
) PARTITIONED BY (placement);
8+
9+
/*+ engine(kafka) */
10+
CREATE TABLE SensorUpdate (
11+
sensor_id INT NOT NULL,
12+
sensor_name STRING NOT NULL,
13+
last_updated TIMESTAMP_LTZ(3) NOT NULL METADATA FROM 'timestamp',
14+
PRIMARY KEY (sensor_id) NOT ENFORCED
15+
);
16+
17+
EXPORT SensorReading TO print.SensorReading;
18+
EXPORT SensorUpdate TO print.SensorUpdate;
19+
20+
EnrichedReading := SELECT r.*, u.sensor_name
21+
FROM SensorReading r
22+
LEFT JOIN SensorUpdate FOR SYSTEM_TIME AS OF r.event_time u
23+
ON r.sensor_id = u.sensor_id
24+
ORDER BY r.event_time ASC;
25+
26+
EnrichedReadingByPlacement(placement STRING NOT NULL) :=
27+
SELECT * FROM EnrichedReading WHERE placement = :placement;
28+
29+
EXPORT EnrichedReading TO print.EnrichedReading;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"data" : {
3+
"update1" : {
4+
"sensor_id" : 101,
5+
"sensor_name" : "Living Room Sensor"
6+
},
7+
"update2" : {
8+
"sensor_id" : 111,
9+
"sensor_name" : "Dining Room Sensor"
10+
},
11+
"update3" : {
12+
"sensor_id" : 121,
13+
"sensor_name" : "Bathroom Room Sensor"
14+
}
15+
}
16+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"data" : {
3+
"add1" : {
4+
"sensor_id" : 101,
5+
"temperature" : 23.5,
6+
"placement" : "DOWNSTAIRS"
7+
},
8+
"add2" : {
9+
"sensor_id" : 101,
10+
"temperature" : 33.5,
11+
"placement" : "DOWNSTAIRS"
12+
},
13+
"add3" : {
14+
"sensor_id" : 111,
15+
"temperature" : 13.5,
16+
"placement" : "UPSTAIRS"
17+
}
18+
}
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"data" : {
3+
"EnrichedReadingByPlacement" : [ {
4+
"sensor_id" : 101,
5+
"temperature" : 23.5,
6+
"placement" : "DOWNSTAIRS",
7+
"sensor_name" : "Living Room Sensor"
8+
}, {
9+
"sensor_id" : 101,
10+
"temperature" : 33.5,
11+
"placement" : "DOWNSTAIRS",
12+
"sensor_name" : "Living Room Sensor"
13+
} ]
14+
}
15+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"data" : {
3+
"EnrichedReading" : [ {
4+
"sensor_id" : 101,
5+
"temperature" : 23.5,
6+
"placement" : "DOWNSTAIRS",
7+
"sensor_name" : "Living Room Sensor"
8+
}, {
9+
"sensor_id" : 101,
10+
"temperature" : 33.5,
11+
"placement" : "DOWNSTAIRS",
12+
"sensor_name" : "Living Room Sensor"
13+
}, {
14+
"sensor_id" : 111,
15+
"temperature" : 13.5,
16+
"placement" : "UPSTAIRS",
17+
"sensor_name" : "Dining Room Sensor"
18+
} ]
19+
}
20+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
mutation SensorUpdates {
2+
update1: SensorUpdate(event: {
3+
sensor_id: 101,
4+
sensor_name: "Living Room Sensor"
5+
}) {
6+
sensor_id
7+
sensor_name
8+
}
9+
update2: SensorUpdate(event: {
10+
sensor_id: 111,
11+
sensor_name: "Dining Room Sensor"
12+
}) {
13+
sensor_id
14+
sensor_name
15+
}
16+
update3: SensorUpdate(event: {
17+
sensor_id: 121,
18+
sensor_name: "Bathroom Room Sensor"
19+
}) {
20+
sensor_id
21+
sensor_name
22+
}
23+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
mutation SensorReadings {
2+
add1: SensorReading(event: {
3+
sensor_id: 101,
4+
temperature: 23.5,
5+
placement: "DOWNSTAIRS"
6+
}) {
7+
sensor_id
8+
temperature
9+
placement
10+
}
11+
add2: SensorReading(event: {
12+
sensor_id: 101,
13+
temperature: 33.5
14+
placement: "DOWNSTAIRS"
15+
}) {
16+
sensor_id
17+
temperature
18+
placement
19+
}
20+
add3: SensorReading(event: {
21+
sensor_id: 111,
22+
temperature: 13.5
23+
placement: "UPSTAIRS"
24+
}) {
25+
sensor_id
26+
temperature
27+
placement
28+
}
29+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
query GetEnrichedReadingByPlacement {
2+
EnrichedReadingByPlacement(placement: "DOWNSTAIRS", limit: 10, offset: 0) {
3+
sensor_id
4+
temperature
5+
placement
6+
sensor_name
7+
}
8+
}

0 commit comments

Comments
 (0)