Skip to content

Commit 5def2ee

Browse files
authored
Merge pull request #3705 from reubenmiller/test-improve-log-assertion
tests: improve log assertion by filtering logs by time
2 parents 3171233 + 2e7a215 commit 5def2ee

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/RobotFramework/tests/mqtt/disconnect_from_broker.robot

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Test Tags theme:mqtt
1414
Publish Connection Closed after publish
1515
[Documentation] Tests that the connection to the MQTT broker is closed after publishing.
1616
Execute Command /setup/bootstrap.sh
17+
${log_start} ThinEdgeIO.Get Unix Timestamp
1718
Execute Command tedge mqtt pub test/topic Hello
18-
${MQTT_PUB} Execute Command journalctl -u mosquitto -n 30
19+
${MQTT_PUB} Execute Command journalctl -u mosquitto --since "@${log_start}" --no-pager
1920
Should Contain ${MQTT_PUB} Received DISCONNECT from tedge-pub
2021

2122
Publish Connection Closed after publish and no error message with TLS
@@ -24,15 +25,17 @@ Publish Connection Closed after publish and no error message with TLS
2425
Set up broker with server and client authentication
2526
tedge configure MQTT server authentication
2627
tedge configure MQTT client authentication
28+
${log_start} ThinEdgeIO.Get Unix Timestamp
2729
Execute Command tedge mqtt pub test/topic Hello
28-
${MQTT_PUB} Execute Command journalctl -u mosquitto -n 30
30+
${MQTT_PUB} Execute Command journalctl -u mosquitto --since "@${log_start}" --no-pager
2931
Should Contain ${MQTT_PUB} Received DISCONNECT from tedge-pub
3032

3133
Subscribe Connection Closed On Interruption
3234
[Documentation] Tests that a subscribe connection to MQTT broker closes upon interruption.
3335
Execute Command /setup/bootstrap.sh
36+
${log_start} ThinEdgeIO.Get Unix Timestamp
3437
Execute Command timeout 2 tedge mqtt sub test/topic ignore_exit_code=True
35-
${MQTT_SUB} Execute Command journalctl -u mosquitto -n 30
38+
${MQTT_SUB} Execute Command journalctl -u mosquitto --since "@${log_start}" --no-pager
3639
Should Contain ${MQTT_SUB} Received DISCONNECT from tedge-sub
3740

3841
Stop subscription on SIGINT even when broker is not available

0 commit comments

Comments
 (0)