Skip to content

Commit 1d17950

Browse files
authored
Merge pull request #3700 from albinsuresh/fix/clear-health-status-on-entity-deregister
fix: clear health status on entity deregister
2 parents 3f5b888 + 5cb5a73 commit 1d17950

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
@@ -328,6 +328,7 @@ impl EntityStoreServer {
328328
ChannelFilter::EntityTwinData,
329329
ChannelFilter::AnyCommand,
330330
ChannelFilter::AnyCommandMetadata,
331+
ChannelFilter::Health,
331332
] {
332333
let topic = self
333334
.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
@@ -124,6 +124,11 @@ async fn delete_entity_clears_retained_data() {
124124
json!({"status": "init"}),
125125
true,
126126
),
127+
(
128+
"te/device/child0///status/health",
129+
json!({"status": "up"}),
130+
true,
131+
),
127132
] {
128133
mqtt_sender
129134
.send(MqttMessage::from((topic, &payload.to_string())).with_retain_flag(retain))
@@ -144,6 +149,7 @@ async fn delete_entity_clears_retained_data() {
144149
MqttMessage::from(("te/device/child0///a/high_temp", "")).with_retain(),
145150
MqttMessage::from(("te/device/child0///cmd/restart", "")).with_retain(),
146151
MqttMessage::from(("te/device/child0///cmd/restart/123", "")).with_retain(),
152+
MqttMessage::from(("te/device/child0///status/health", "")).with_retain(),
147153
MqttMessage::from(("te/device/child0//", "")).with_retain(),
148154
])
149155
.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)