fix: stabilize IoT Hub state migration integration tests - #858
Closed
HangyiWang wants to merge 4 commits into
Closed
fix: stabilize IoT Hub state migration integration tests#858HangyiWang wants to merge 4 commits into
HangyiWang wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Improves reliability and debuggability of the IoT Hub state migration integration tests by ensuring CLI failures surface immediately (with underlying ARM errors) instead of cascading into misleading downstream assertions.
Changes:
- Fail fast on migration and endpoint operations by asserting
cli.invoke(...).success()and surfacingget_error()details. - Stabilize hub-infrastructure marker discovery and fixture behavior (avoid cross-module marker bleed; avoid mutating shared state).
- Align CI/tox installation behavior to reduce dependency/ABI mismatches (install deps into tox env; install extension into az extension dir without deps).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Installs project deps into tox env and installs extension into the tox-managed Azure CLI extension dir with --no-deps to avoid python/ABI mismatches. |
| setup.cfg | Registers hub_infrastructure pytest marker to avoid marker warnings and clarify test semantics. |
| azext_iot/tests/test_helpers_unit.py | Adds unit coverage for get_closest_marker selection and fallback scoping behavior. |
| azext_iot/tests/iothub/state/test_hub_state_methods_unit.py | Updates unit test expectations to ensure ARM deployment errors are surfaced in raised exceptions. |
| azext_iot/tests/iothub/state/test_hub_state_int.py | Makes integration tests fail fast on CLI failures; improves cleanup and endpoint deletion robustness. |
| azext_iot/tests/iothub/conftest.py | Makes marker handling resilient when no hub_infrastructure marker is present on the current node. |
| azext_iot/tests/helpers.py | Fixes marker lookup to prefer current node and limit fallback to the current module’s tests. |
| azext_iot/iothub/providers/state.py | Includes underlying ARM deployment error details when raising BadRequestError. |
| azext_iot/iothub/providers/helpers/state_strings.py | Extends the ARM failure message template to include error details. |
| .github/workflows/int_test.yml | Removes wheel-based az extension add install flow; relies on tox-based extension installation to avoid python-version dependency issues. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+199
to
+200
| for hub in hub_states[len(setup_hub_controlplane_states):]: | ||
| cli.invoke(f"iot hub delete -n {hub['name']} -g {setup_hub_controlplane_states[0]['rg']}") |
Member
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes misleading and unreliable failures in the IoT Hub state migration integration tests. Migration commands could fail silently, causing later assertions to report missing endpoints or missing hubs instead of the underlying ARM deployment error.
A green run: https://github.com/Azure/azure-iot-cli-extension/actions/runs/29275154618