test(matter): Add device_interactor for side-channel#140
test(matter): Add device_interactor for side-channel#140cleithner-comcast merged 7 commits intomainfrom
Conversation
To enable tests to manipulate matter devices through a side channel, this commit adds device_interactor which is backed by chip-tool. Concrete device fixtures are commissioned by chip-tool and then their commissioning window is re-opened so that they can be commissioned by barton. This commit also adds "clusters" which are just abstractions for cluster interactions, utilizing the device_interactor. Tests can trivially access a device fixture's cluster and perform an interaction through it. Refs: BARTON-343
|
b'## Copyright scan failure |
There was a problem hiding this comment.
Pull request overview
This PR adds side-channel device interaction capabilities for Matter device testing by introducing device_interactor backed by chip-tool. The changes enable tests to manipulate Matter devices outside of the primary control path, supporting multi-admin commissioning scenarios.
Changes:
- Added
ChipToolDeviceInteractorclass for executing chip-tool commands against Matter devices - Implemented cluster abstraction interfaces (OnOff, LevelControl, ColorControl) for simplified device interactions
- Refactored
MatterDeviceto support cluster registration and multi-admin commissioning workflows - Added new test demonstrating light on/off control via side channel
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/test/light_test.py | Added test validating light on/off state changes through side-channel cluster interaction |
| testing/mocks/devices/matter/matter_light.py | Registered supported clusters and updated fixture to enable multi-admin commissioning |
| testing/mocks/devices/matter/matter_device.py | Added cluster management, removed pipe-based communication, added KVS isolation |
| testing/mocks/devices/matter/device_interactor.py | New module providing chip-tool wrapper for device commissioning and cluster interactions |
| testing/mocks/devices/matter/clusters/onoff_cluster.py | New OnOff cluster implementation with command and attribute methods |
| testing/mocks/devices/matter/clusters/matter_cluster.py | New abstract base class for Matter cluster interfaces |
| testing/mocks/devices/matter/clusters/levelcontrol_cluster.py | New LevelControl cluster implementation for brightness/level control |
| testing/mocks/devices/matter/clusters/colorcontrol_cluster.py | New ColorControl cluster implementation for color manipulation |
| testing/conftest.py | Added device_interactor fixture registration |
| pyproject.toml | Enabled pytest-forked plugin for test isolation |
| docker/version | Bumped Docker image version |
| docker/Dockerfile | Pinned pygobject-stubs version and added pytest-forked dependency |
| .vscode/settings.json | Configured pytest to run tests from testing directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
b'## Copyright scan failure |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
b'## Copyright scan failure |
|
b'## Copyright scan failure |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
b'## WARNING: A Copyright scan failure has been waived A prior failure has been upvoted
|
|
b'## Copyright scan failure |
|
b'## WARNING: A Copyright scan failure has been waived A prior failure has been upvoted
|
|
b'## Copyright scan failure |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@cleithner-comcast I've opened a new pull request, #145, to work on those changes. Once the pull request is ready, I'll request review from you. |
Applied fixes for three unresolved code review comments from PR #140: - **Removed unused imports**: Cleaned up `threading` and `Callable` imports from `testing/test/light_test.py` - **Moved module-level import**: Relocated `re` import to top of `device_interactor.py` per Python conventions - **Added commissioning window failure handling**: Device registration now raises `RuntimeError` if commissioning window fails to open when `open_commissioning_window=True`, preventing silent failures during multi-admin setup ```python if open_commissioning_window: result, new_code = self._open_commissioning_window(...) if not result.success: raise RuntimeError( f"Failed to open commissioning window on node {node_id}: {result.stderr}" ) ``` <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cleithner-comcast <87389808+cleithner-comcast@users.noreply.github.com>
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
|
b'## Copyright scan failure |
|
b'## WARNING: A Copyright scan failure has been waived A prior failure has been upvoted
|
tleacmcsa
left a comment
There was a problem hiding this comment.
I hereby formally approve this Pull Request.
To enable tests to manipulate matter devices through a side channel, this commit adds device_interactor which is backed by chip-tool. Concrete device fixtures are commissioned by chip-tool and then their commissioning window is re-opened so that they can be commissioned by barton. This commit also adds "clusters" which are just abstractions for cluster interactions, utilizing the device_interactor. Tests can trivially access a device fixture's cluster and perform an interaction through it.
Refs: BARTON-343