Skip to content

Commit fbc90fb

Browse files
committed
enable retries by using pipefail option in bash
By default shells don't stop on pipe errors (e.g. if the tedge http get command fails), so jq will always control the overall exit code as it is the last process in the pipe. Using pipefail will ensure that the Execute Command will be retried if the http get command fails for some transient reason (e.g. service is restarting, or the network infrastructure has sporadic issues). Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
1 parent ee731a8 commit fbc90fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/RobotFramework/tests/tedge/tedge_http.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Updating entities from a child device
4747

4848
Accessing c8y from a child device
4949
${external_id}= Execute Command
50-
... tedge http get /c8y/identity/externalIds/c8y_Serial/${PARENT_SN} | jq .externalId
51-
Should Be Equal ${external_id} "${PARENT_SN}"\n
50+
... bash -o pipefail -c "tedge http get /c8y/identity/externalIds/c8y_Serial/${PARENT_SN} | jq -r .externalId"
51+
Should Be Equal ${external_id} ${PARENT_SN}\n
5252

5353
Accessing file-transfer from a child device
5454
Execute Command printf "source file content" >/tmp/source-file.txt

0 commit comments

Comments
 (0)