Closed reubenmiller closed 1 year ago
Some things that contributed to this bug:
service.type
is used, but there is no tests that check if the converter is emitting correct messages in the first place.,,
being present inside a smartrest message is obviously invalid smartrest, and if proper abstraction was used that checked for this type of errors, it would be much easier to detect the bug.""
(empty string) is invalid value for a service.type
. Instead of the caller code having to handle ""
as invalid value, it would be better if tedge_config
returned default value (service
) if the user set service.type
to empty string, or it should even disallow setting service.type
to invalid value in the first place. A user setting service.type
to ""
might be confused by service
default being used, and it would better to tell them earlier that ""
is an invalid value for service.type
.These will be worked on in order.
Closing as there was already a system test covering this scenario, and the linked PR just re-enabled the test case.
Describe the bug
tedge-mapper-c8y is sending invalid service registration messages to Cumulocity IoT when the
service.type
setting is set to an empty string.Below shows the Cumulocity smart rest message to register a service (message id
102
), and the,,
shows that the service type is missing. Cumulocity also publishes an error message on the localc8y/s/e
topic indicating that the service name and type can not be empty values.To Reproduce
The test case is already covered by the following system test, however the test case seems to be flakey.
Test if all c8y services using default service type when service type configured as empty
But the following manual procedure can be executed to observer the error:
Connect thin-edge.io to Cumulocity IoT
Configure the service.type
Restart the mapper
Open a different console and subscribe to the local cumulocity topic
In the previous console, restart the tedge-agent
Observe the output from the
tedge mqtt sub
command in the previous stepsThe bug is visible if there is an error message received on the
c8y/s/e
topic indicating that the service name/type should not be empty.Expected behavior
A non-empty value should always be used in the service type field of the
102
smart rest message, and there should not be any correspondingc8y/s/e
message received.An empty value used by
service.type
should be treated the same as an unset value (e.g. usingservice
as the default value).Screenshots
Environment (please complete the following information):
0.12.1~501+g7259158
Additional context