-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[ICD] Add automation for ICDB 1.1 cert test #40007
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
base: master
Are you sure you want to change the base?
[ICD] Add automation for ICDB 1.1 cert test #40007
Conversation
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.
Code Review
This pull request adds an automated test case TC_ICDB_1_1
for the ICD Check-In Protocol. The changes include a new Python test script, modifications to the test application configuration to speed up ICD state transitions, and updates to the PICS file to enable the new test. The new test script is well-structured, but I've found several instances of incorrect error handling logic that could lead to confusing test failures. I've also suggested a small simplification in the test cleanup logic.
try: | ||
registered_clients = await self.read_single_attribute_check_success(endpoint=0, cluster=Clusters.Objects.IcdManagement, attribute=attributes.RegisteredClients) | ||
except InteractionModelError as e: | ||
asserts.assert_equal(e.status, Status.Success, "Failed to read RegisteredClients attribute") |
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 error handling logic here is incorrect. If an InteractionModelError
is caught, it signifies a failure, so e.status
will not be Status.Success
. The current assertion will always fail, but with a potentially confusing message. It's better to directly fail the test with asserts.fail
and provide a clear error message that includes the exception details.
asserts.assert_equal(e.status, Status.Success, "Failed to read RegisteredClients attribute") | |
asserts.fail(f"Failed to read RegisteredClients attribute: {e}") |
try: | ||
await self.send_single_cmd(cmd=commands.UnregisterClient(checkInNodeID=client.checkInNodeID), endpoint=0) | ||
except InteractionModelError as e: | ||
asserts.assert_equal(e.status, Status.Success, f"Failed to unregister client {client.checkInNodeID}: {e}") |
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.
This error handling logic is incorrect for the same reason as the previous one. An InteractionModelError
indicates a failure, so e.status
will not be Status.Success
. The assertion should be replaced with asserts.fail
for clear and direct failure reporting.
asserts.assert_equal(e.status, Status.Success, f"Failed to unregister client {client.checkInNodeID}: {e}") | |
asserts.fail(f"Failed to unregister client {client.checkInNodeID}: {e}") |
f"ActiveModeThreshold: {active_mode_threshold_ms}ms") | ||
|
||
except InteractionModelError as e: | ||
asserts.assert_equal(e.status, Status.Success, "Failed to read ICD configuration attributes") |
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.
This error handling logic is also incorrect. An InteractionModelError
indicates a failure, so e.status
will not be Status.Success
. The assertion should be replaced with asserts.fail
for clear and direct failure reporting, including the exception details.
asserts.assert_equal(e.status, Status.Success, "Failed to read ICD configuration attributes") | |
asserts.fail(f"Failed to read ICD configuration attributes: {e}") |
if require_unregister: | ||
try: | ||
if registration_info: | ||
await self.th2.UnpairDevice(self.dut_node_id) | ||
except Exception as e: | ||
asserts.fail(f"Failed to unregister client: {e}") | ||
pass |
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 cleanup logic in the finally
block can be simplified for better readability and maintainability.
- The check
if require_unregister:
is sufficient to determine if unpairing is needed. Theregistration_info
check is redundant. - The
pass
statement on line 180 is unreachable becauseasserts.fail
raises an exception and terminates the execution.
if require_unregister: | |
try: | |
if registration_info: | |
await self.th2.UnpairDevice(self.dut_node_id) | |
except Exception as e: | |
asserts.fail(f"Failed to unregister client: {e}") | |
pass | |
if require_unregister: | |
try: | |
await self.th2.UnpairDevice(self.dut_node_id) | |
except Exception as e: | |
asserts.fail(f"Failed to unregister client: {e}") |
PR #40007: Size comparison from d0ded4d to 673bece Full report (59 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #40007: Size comparison from d0ded4d to 7483ee6 Full report (11 builds for cc13x4_26x4, cc32xx, qpg, stm32, tizen)
|
PR #40007: Size comparison from d0ded4d to f4314b8 Full report (35 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, nrfconnect, psoc6, qpg, stm32, telink, tizen)
|
PR #40007: Size comparison from d0ded4d to 172e74f Increases above 0.2%:
Full report (59 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
DO NOT REVIEW - Still testing with CI
Summary
TBU
Related issues
TBU
Testing
TBU
Readability checklist
The checklist below will help the reviewer finish PR review in time and keep the
code readable:
descriptive
“When in Rome…”
rule (coding style)
See: Pull Request Guidelines