Skip to content

fix: stabilize IoT Hub state migration integration tests - #858

Closed
HangyiWang wants to merge 4 commits into
previewfrom
users/hangyiwang/hub-int-test-fix
Closed

fix: stabilize IoT Hub state migration integration tests#858
HangyiWang wants to merge 4 commits into
previewfrom
users/hangyiwang/hub-int-test-fix

Conversation

@HangyiWang

@HangyiWang HangyiWang commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

@HangyiWang
HangyiWang marked this pull request as ready for review July 13, 2026 20:20
@HangyiWang
HangyiWang requested a review from digimaun as a code owner July 13, 2026 20:20
Copilot AI review requested due to automatic review settings July 13, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 surfacing get_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.

Copilot AI review requested due to automatic review settings July 14, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 14, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

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']}")
@cheatsheet1999

Copy link
Copy Markdown
Member
image Hmm... Again? 🤨

@HangyiWang

Copy link
Copy Markdown
Contributor Author

image Hmm... Again? 🤨

🤮

@HangyiWang HangyiWang closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants