-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add system test for the SmartREST templates #3202
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: gligorisaev <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good start. However the most important (and tricky) part is the invocation from Cumulocity https://thin-edge.github.io/thin-edge.io/operate/c8y/smartrest-templates/#example-creating-a-custom-operation
Note: the links given in the PR's description are broken.
|
||
Verify Non-Existing SmartREST Templates | ||
${output}= Execute Command tedge config get c8y.smartrest.templates | ||
Should Match Regexp ${output} ^\s*(\\[\\]|\bnone\b|null)\s*$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tedge config will never returns none
or null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thoughts behind this were instead of assuming the output will be [], to ensure the keyword can handle different potential outputs for no templates, making the test more robust, not for now but also in the future. I can change it to the state that I had before Should Contain ${output} []
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c8y.smartrest.templates
is a list of templates, hence none
and null
values are to be rejected as errors.
tests/RobotFramework/tests/cumulocity/smartrest/smartrest_templates.robot
Outdated
Show resolved
Hide resolved
Signed-off-by: gligorisaev <[email protected]>
Exactly, this is the missing part that we found out during the work on #3189. All of our existing custom operations tests use the topic For example, (c8y_RelayArray) [exec]
topic = "c8y/s/ds"
on_message = "519"
result_format = "csv"
command = "/etc/tedge/operations/set_relay.sh"
timeout = 10 However, as you see in our doc, we also supports the topics for the custom templates. [exec]
command = "/usr/bin/set_wifi"
topic = "c8y/s/dc/custom_devmgmt"
on_message = "dm101" During the work of #3189, accidentally it removed the support for the custom template topic. However, all tests passed and we couldn't find it easily because we don't have a test case to cover it. That's the motivation to request you to create a test following the guide. |
To mitigate this risk that any future changes to the codebase could introduce errors or regressions that go unnoticed, which might still pass the build workflow due to the lack of automated coverage for this feature, I have implemented a system test suite for SmartREST templates based on our documentation.
The purpose of this test suite is to ensure that any updates or modifications related to SmartREST templates are properly verified during the build process.
Test Suite Details:
The test suite covers:
Types of changes
Paste Link to the issue
#3199
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments