From 7515f3acf7edddfb93bfd160526510cf576f59bc Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Sat, 5 Oct 2024 16:47:38 +0200 Subject: [PATCH] fix(systemd): publish firmware information with retain flag Signed-off-by: Reuben Miller --- images/common/utils/set-startup-info | 2 +- .../debian-systemd/children-systemd/operations.robot | 3 +++ tests/debian-systemd/main/operations.robot | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/images/common/utils/set-startup-info b/images/common/utils/set-startup-info index a354dca..2f5c08f 100755 --- a/images/common/utils/set-startup-info +++ b/images/common/utils/set-startup-info @@ -3,7 +3,7 @@ set -e TARGET="$(tedge config get mqtt.topic_root)/$(tedge config get mqtt.device_topic_id)" # firmware -tedge mqtt pub --qos 1 "$TARGET/twin/firmware" "$(printf '{"name": "iot-linux", "version": "1.0.0"}')" +tedge mqtt pub -r --qos 1 "$TARGET/twin/firmware" "$(printf '{"name": "iot-linux", "version": "1.0.0"}')" # Trigger inventory service on startup if command -V systemd; then diff --git a/tests/debian-systemd/children-systemd/operations.robot b/tests/debian-systemd/children-systemd/operations.robot index 06cd54e..e4e6f1d 100644 --- a/tests/debian-systemd/children-systemd/operations.robot +++ b/tests/debian-systemd/children-systemd/operations.robot @@ -7,6 +7,9 @@ Suite Setup Set Child Device2 *** Test Cases *** +Firmware information should be shown on startup + Cumulocity.Managed Object Should Have Fragment Values c8y_Firmware.name\=iot-linux c8y_Firmware.version\=1.0.0 + Install Firmware Cumulocity.Should Have Services name=tedge-agent status=up ${date_from}= Get Test Start Time diff --git a/tests/debian-systemd/main/operations.robot b/tests/debian-systemd/main/operations.robot index 77414c8..a638dee 100644 --- a/tests/debian-systemd/main/operations.robot +++ b/tests/debian-systemd/main/operations.robot @@ -7,6 +7,18 @@ Suite Setup Set Main Device *** Test Cases *** +Firmware information should be shown on startup + Cumulocity.Managed Object Should Have Fragment Values c8y_Firmware.name\=iot-linux c8y_Firmware.version\=1.0.0 + +Install Firmware + Cumulocity.Should Have Services name=tedge-agent status=up + ${date_from}= Get Test Start Time + Sleep 1s + ${binary_url}= Cumulocity.Create Inventory Binary iot-linux child-firmware contents=dummy_file + ${operation}= Cumulocity.Install Firmware name=iot-linux version=2.0.0 url=${binary_url} + Operation Should Be SUCCESSFUL ${operation} timeout=90 + Cumulocity.Managed Object Should Have Fragment Values c8y_Firmware.name\=iot-linux c8y_Firmware.version\=2.0.0 c8y_Firmware.url\=${binary_url} + Restart device ${date_from}= Get Test Start Time Sleep 1s