Skip to content

Commit 5cb5a73

Browse files
committed
fix: clear health status on entity deregister
1 parent c440c03 commit 5cb5a73

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

crates/core/tedge_agent/src/entity_manager/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ impl EntityStoreServer {
324324
ChannelFilter::EntityTwinData,
325325
ChannelFilter::AnyCommand,
326326
ChannelFilter::AnyCommandMetadata,
327+
ChannelFilter::Health,
327328
] {
328329
let topic = self
329330
.mqtt_schema

crates/core/tedge_agent/src/entity_manager/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ async fn delete_entity_clears_retained_data() {
123123
json!({"status": "init"}),
124124
true,
125125
),
126+
(
127+
"te/device/child0///status/health",
128+
json!({"status": "up"}),
129+
true,
130+
),
126131
] {
127132
mqtt_sender
128133
.send(MqttMessage::from((topic, &payload.to_string())).with_retain_flag(retain))
@@ -143,6 +148,7 @@ async fn delete_entity_clears_retained_data() {
143148
MqttMessage::from(("te/device/child0///a/high_temp", "")).with_retain(),
144149
MqttMessage::from(("te/device/child0///cmd/restart", "")).with_retain(),
145150
MqttMessage::from(("te/device/child0///cmd/restart/123", "")).with_retain(),
151+
MqttMessage::from(("te/device/child0///status/health", "")).with_retain(),
146152
MqttMessage::from(("te/device/child0//", "")).with_retain(),
147153
])
148154
.await;

tests/RobotFramework/tests/tedge_agent/http_server/entity_store_api.robot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,9 @@ Delete entity clears entity registration and all retained data messages
513513

514514
${deleted}= Deregister Entity device/child0//
515515

516-
Should Not Have Retained MQTT Messages te/device/child000//#
517-
Should Not Have Retained MQTT Messages te/device/child00//#
518-
Should Not Have Retained MQTT Messages te/device/child0//#
516+
Should Not Have Retained MQTT Messages te/device/child000/#
517+
Should Not Have Retained MQTT Messages te/device/child00/#
518+
Should Not Have Retained MQTT Messages te/device/child0/#
519519

520520

521521
*** Keywords ***

0 commit comments

Comments
 (0)