11*** Settings ***
2+ Library JSONLibrary
23Library ThinEdgeIO
34
45Suite Setup Custom Setup
@@ -111,8 +112,9 @@ Consuming messages from a process stdout, periodically
111112
112113Consuming messages from the tail of file
113114 # Assuming the flow tail-named-pipe.toml has been properly installed
114- Execute Command (for i in $(seq 10); do sleep 1; echo hello>/tmp/events; done)&
115- Execute Command tedge mqtt sub log/events --duration 2s | grep hello
115+ ${start } Get Unix Timestamp
116+ Execute Command echo hello>/tmp/events
117+ Should Have MQTT Messages topic=log/events message_contains=hello minimum=1 date_from=${start }
116118
117119Consuming messages from a file, periodically
118120 # Assuming the flow read-file-periodically.toml has been properly installed
@@ -135,12 +137,32 @@ Appending messages to a file
135137
136138Publishing transformation errors
137139 # Assuming the flow publish-js-errors.toml has been properly installed
138- Execute Command (for i in $(seq 3); do sleep 1; tedge mqtt pub collectd/foo 12345:6789; done)&
139- Execute Command tedge mqtt sub test/errors --duration 2s | grep 'Error: Not a collectd topic'
140- Execute Command (for i in $(seq 3); do sleep 1; tedge mqtt pub collectd/a/b/c foo,bar; done)&
141- Execute Command tedge mqtt sub test/errors --duration 2s | grep 'Error: Not a collectd payload'
142- Execute Command (for i in $(seq 3); do sleep 1; tedge mqtt pub collectd/a/b/c 12345:6789; done)&
143- Execute Command tedge mqtt sub test/output --duration 2s | grep '{"time": 12345, "b": {"c": 6789}}'
140+ ${start } Get Unix Timestamp
141+ Execute Command tedge mqtt pub collectd/foo 12345:6789
142+ Should Have MQTT Messages
143+ ... topic=test/errors
144+ ... minimum=1
145+ ... message_contains=Error: Not a collectd topic
146+ ... date_from=${start }
147+
148+ ${start } Get Unix Timestamp
149+ Execute Command tedge mqtt pub collectd/a/b/c foo,bar
150+ Should Have MQTT Messages
151+ ... topic=test/errors
152+ ... minimum=1
153+ ... message_contains=Error: Not a collectd payload
154+ ... date_from=${start }
155+
156+ ${start } Get Unix Timestamp
157+ Execute Command tedge mqtt pub collectd/a/b/c 12345:6789
158+ ${messages } Should Have MQTT Messages
159+ ... topic=test/output
160+ ... minimum=1
161+ ... message_contains=time
162+ ... date_from=${start }
163+ ${message } JSONLibrary.Convert String To Json ${messages[0] }
164+ Should Be Equal As Integers ${message["time"] } 12345
165+ Should Be Equal As Integers ${message["b"]["c"] } 6789
144166
145167
146168*** Keywords ***
0 commit comments