fix(check): add deviceregistry Device evaluation for namespaced API#852
fix(check): add deviceregistry Device evaluation for namespaced API#852ketkimnaik wants to merge 8 commits intoAzure:devfrom
Conversation
| evaluate_funcs=namespaced_evaluate_funcs, | ||
| as_list=as_list, | ||
| detail_level=detail_level, | ||
| resource_kinds=resource_kinds, |
There was a problem hiding this comment.
The command supports filtering by resource type via --resources. One part is adding the namespace devices and assets to that list. But here, what is the experience if the user passes in az iot ops check --svc deviceregistry --resources assetendpointprofile or in the higher up check_post_deployment( api_info=DEVICEREGISTRY_API_V1, ...) processes az iot ops check --svc deviceregistry --resources device?
There was a problem hiding this comment.
Or another way to put is if it's better to have conditions based on if the resource kind belongs to the API.
There was a problem hiding this comment.
Fixed — resource_kinds is now pre-filtered per API group before being passed to each check_post_deployment call. If a requested kind doesn't belong to that group, the entire call is skipped rather than inadvertently running all evaluations with an empty filter.
| @pytest.fixture | ||
| def mock_generate_deviceregistry_device_target_resources(mocker): | ||
| patched = mocker.patch( | ||
| "azext_edge.edge.providers.check.deviceregistry.generate_target_resource_name", |
There was a problem hiding this comment.
an observation that this is the same patch as the fixture above it, so if there is a case that they both need to be used at the same time, the last patch wins
There was a problem hiding this comment.
Good catch! I merged both fixtures into a single one using a side_effect that dispatches on api_info.group, so the correct target name is returned regardless of which API group is under test. mock_generate_deviceregistry_device_target_resources is now just an alias pointing to the same fixture, so there's only ever one patch registered on generate_target_resource_name per test.
| detail_level, | ||
| resource_name, | ||
| ): | ||
| mocker = mocker.patch( |
There was a problem hiding this comment.
mocker is a special name in this context, lets call this variable something else. Maybe mock_get_resources?
There was a problem hiding this comment.
Renamed to mock_get_resources, but since it was unused (no call assertions needed) dropped the assignment entirely — the patch is still active.
We have namespace devices now in
az iot ops check --svc deviceregistry:With status object:
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Thank you for contributing to Azure IoT Operations tooling!
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
Intent for Production
devormainare of production grade. Corollary to this, any merged contributions to these branches may be deployed in a public release at any given time. By checking this box, you agree and commit to the expected production quality of code.Basic expectations
pytest <project root> -vv. Please provide evidence in the form of a screenshot showing a succesful run of tests locally OR a link to a test pipeline that has been run against the change-set..pylintrcand.flake8rules? Look at the CI scripts for example usage.Azure IoT Operations CLI maintainers reserve the right to enforce any of the outlined expectations.
A PR is considered ready for review when all basic expectations have been met (or do not apply).