|
| 1 | +*** Settings *** |
| 2 | +Resource ../../../resources/common.resource |
| 3 | +Library Cumulocity |
| 4 | +Library ThinEdgeIO |
| 5 | + |
| 6 | +Test Tags theme:c8y theme:troubleshooting theme:plugins |
| 7 | +Suite Setup Custom Setup |
| 8 | +Test Teardown Get Logs |
| 9 | + |
| 10 | +*** Test Cases *** |
| 11 | + |
| 12 | +Successful shell command with output |
| 13 | + ${operation}= Cumulocity.Execute Shell Command echo helloworld |
| 14 | + Operation Should Be SUCCESSFUL ${operation} |
| 15 | + Should Be Equal ${operation.to_json()["c8y_Command"]["result"]} helloworld\n |
| 16 | + |
| 17 | +Check Successful shell command with literal double quotes output |
| 18 | + ${operation}= Cumulocity.Execute Shell Command echo \\"helloworld\\" |
| 19 | + Operation Should Be SUCCESSFUL ${operation} |
| 20 | + Should Be Equal ${operation.to_json()["c8y_Command"]["result"]} "helloworld"\n |
| 21 | + |
| 22 | +Execute multiline shell command |
| 23 | + ${operation}= Cumulocity.Execute Shell Command echo "hello"${\n}echo "world" |
| 24 | + Operation Should Be SUCCESSFUL ${operation} |
| 25 | + Should Be Equal ${operation.to_json()["c8y_Command"]["result"]} hello\nworld\n |
| 26 | + |
| 27 | +Failed shell command |
| 28 | + ${operation}= Cumulocity.Execute Shell Command exit 1 |
| 29 | + Operation Should Be FAILED ${operation} |
| 30 | + |
| 31 | + |
| 32 | +*** Keywords *** |
| 33 | + |
| 34 | +Custom Setup |
| 35 | + ${DEVICE_SN}= Setup |
| 36 | + Set Suite Variable $DEVICE_SN |
| 37 | + Device Should Exist ${DEVICE_SN} |
| 38 | + ThinEdgeIO.Execute Command tedge config set c8y.bridge.built_in true |
| 39 | + ThinEdgeIO.Execute Command tedge config set c8y.bridge.topic_prefix custom-c8y |
| 40 | + ThinEdgeIO.Transfer To Device ${CURDIR}/command_handler.* /etc/tedge/operations/command |
| 41 | + ThinEdgeIO.Transfer To Device ${CURDIR}/c8y_Command* /etc/tedge/operations/c8y/ |
| 42 | + ThinEdgeIO.Restart Service tedge-agent |
| 43 | + ThinEdgeIO.Execute Command tedge reconnect c8y |
0 commit comments