-
Notifications
You must be signed in to change notification settings - Fork 521
Improve test coverage and backwards compatibility for matter switch tests #2028
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
Improve test coverage and backwards compatibility for matter switch tests #2028
Conversation
|
Channel deleted. |
Test Results 66 files 424 suites 0s ⏱️ Results for commit 32a9f65. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 32a9f65 |
63574b2 to
7188758
Compare
4ea4089 to
a07ec42
Compare
Add backwards compatibility for matter switch test cases down to lua libs version v10. Most of the issues were from test cases expecting native handler registrations, which was added in v11. Also, running the test cases against lower lua libs caught a bug in the driver code for lua libs version v10 and lower, which prevented the energyMeter capability from being emitted. This is also fixed by this PR. It might be possible to extend support to even lower versions, but there are a few additional api changes that would need to be accounted for. Also note that to run these tests against lower versions, any capabilities that are not available in that version of the lua libs would need to be manually added to prevent test failures.
a07ec42 to
be5f48e
Compare
This commit removes some unreachable code and also adds new test cases to improve code coverage.
daf4874 to
f8ae614
Compare
409c457 to
b9c573d
Compare
Add new test cases to cover areas missing test coverage.
b9c573d to
32a9f65
Compare
| end | ||
|
|
||
| local function mired_to_kelvin(value, minOrMax) | ||
| if value == 0 then -- shouldn't happen, but has |
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 code is unreachable because 0 is outside of the range of "sane" values checked at the call site
| elseif minOrMax == COLOR_TEMP_MAX then | ||
| else -- minOrMax = COLOR_TEMP_MAX | ||
| return utils.round(MIRED_KELVIN_CONVERSION_CONSTANT / (kelvin_step_size * (value - 1)) - rounding_value) * kelvin_step_size | ||
| else |
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 else is unreachable because this function is only called with COLOR_TEMP_MIN or COLOR_TEMP_MAX, so it can be removed
| if ep.endpoint_id == endpoint_id then | ||
| for _, dt in ipairs(ep.device_types) do | ||
| if dt.device_type_id == DIMMABLE_LIGHT_DEVICE_TYPE_ID then | ||
| for _, fingerprint in ipairs(child_device_profile_overrides_per_vendor_id[0x115F]) do |
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 Aqara device uses device type 0x100, while DIMMABLE_LIGHT_DEVICE_TYPE_ID is 0x101, so this code can be removed
| end | ||
|
|
||
| local function configure_buttons(device) | ||
| if device.network_type == device_lib.NETWORK_TYPE_CHILD then |
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 check is already done at both call sites of configure_buttons so it can be removed
|
do you think this is worth a rebase? Should we close this? Just checking since it's been open for ~6 months. |
I would say probably not because backwards compatibility was broken by scripting engine changes. Closing |
Type of Change
Description of Change
Add backwards compatibility for matter switch test cases down to lua libs version v10 and improve overall test coverage. Most of the issues were from test cases expecting native handler registrations, which was added in v11. This PR also fixes a bug in the driver code for lua libs version v10 and lower, which prevented the energyMeter capability from being emitted.
It might be possible to extend support to even lower versions, but there are a few additional api changes that would need to be accounted for.
Also note that to run these tests against lower versions, any capabilities that are not available in that version of the lua libs would need to be manually added to prevent test failures.