Description
Describe the bug
De-registering a child device via the entity store HTTP API does not clean up all of the related MQTT topics, for example, below shows that the name and type digital twin properties are still present:
tedge mqtt sub 'te/device/child01/service/custom-app/#'
[te/device/child01/service/custom-app/twin/name] "custom-app"
[te/device/child01/service/custom-app/twin/type] "custom-type"
The bug was found whilst trying to refactor the tests/RobotFramework/tests/cumulocity/registration/registration_lifecycle.robot
test to use the deregistration API instead of manually clearing MQTT messages.
To Reproduce
-
Register a child device
tedge mqtt pub --retain 'te/device/child01//' '{"@type":"child-device","name":"${CHILD_SN}","type":"linux-device-Aböut"}'
-
Register a service of the child device
tedge mqtt pub --retain 'te/device/child01/service/custom-app' '{"@type":"service","@parent":"device/child01//","name":"custom-app","type":"custom-type"}'
-
De-register the service via the HTTP API
tedge http delete /tedge/entity-store/v1/entities/device/child01/service/custom-app
Expected behavior
After a service is deregistered (~1-2 seconds after), then all MQTT messages related to that service should no longer be stored as retained messages on the broker.
tedge mqtt sub 'te/device/child01/service/custom-app/#'
Screenshots
Environment (please complete the following information):
Property | Value |
---|---|
OS [incl. version] | Debian GNU/Linux 12 (bookworm) |
Hardware [incl. revision] | unknown |
System-Architecture | Linux b4c8b1418fda 6.8.0-39-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Sat Jul 6 02:50:39 UTC 2024 aarch64 GNU/Linux |
thin-edge.io version | tedge 1.4.3~316+gaa844f8 |
Additional context