Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,21 @@ Placeholder workflow created for ill-defined operations
${workflow_log} Execute Command cat /var/log/tedge/agent/workflow-issue-3079-test-1.log
Should Contain ${workflow_log} item=TOML parse error

Trigger wrapped workflow without an intermediate state
# [Documentation]
Execute Command
... cmd=echo 'tedge ALL = (ALL) NOPASSWD:SETENV: /usr/bin/tedge, /usr/bin/systemctl, /etc/tedge/sm-plugins/[a-zA-Z0-9]*, /bin/sync, /sbin/init, /sbin/shutdown, /usr/sbin/reboot, /usr/bin/on_shutdown.sh' > /etc/sudoers.d/tedge
${pid_before} Execute Command sudo systemctl show --property MainPID tedge-agent
Execute Command
... tedge mqtt pub --retain te/device/main///cmd/restart-tedge-agent-wrapper/robot-1 '{"status":"init"}'
Should Have MQTT Messages
... te/device/main///cmd/restart-tedge-agent-wrapper/robot-1
... message_pattern=.*successful.*
... maximum=1
... timeout=120
${pid_after} Execute Command sudo systemctl show --property MainPID tedge-agent
Should Not Be Equal ${pid_before} ${pid_after} msg=tedge-agent should have been restarted


*** Keywords ***
Custom Test Setup
Expand All @@ -217,6 +232,8 @@ Copy Configuration Files
ThinEdgeIO.Transfer To Device ${CURDIR}/restart-tedge-agent.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/tedge-agent-pid.sh /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/native-reboot.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/restart-tedge-agent-wrapper.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/restart-tedge-agent-internal.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/gp_command.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/super_command.toml /etc/tedge/operations/
ThinEdgeIO.Transfer To Device ${CURDIR}/sub_command.toml /etc/tedge/operations/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
operation = "restart-tedge-agent-internal"

[init]
action = "proceed"
on_success = "restart"

[restart]
background_script = "sudo systemctl restart tedge-agent"
on_exec = "restarting"

[restarting]
action = "await-agent-restart"
# on_success = "restarted" # Result: PASS
on_success = "successful" # Result: FAIL
timeout_second = 30
on_timeout = "failed"

[restarted]
action = "proceed"
on_success = "successful"

[successful]
action = "cleanup"

[failed]
action = "cleanup"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
operation = "restart-tedge-agent-wrapper"

[init]
action = "proceed"
on_success = "restart"

[restart]
operation = "restart-tedge-agent-internal"
on_exec = "restarting"

[restarting]
action = "await-operation-completion"
on_success = "successful"

[successful]
action = "cleanup"

[failed]
action = "cleanup"
Loading