[Resource] Fix #34004: az resource wait: Raise CLIError on timeout instead of returning it - #34009
Conversation
…eout instead of returning it * Initial plan * fix: raise CLIError on wait timeout instead of returning it Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com> * fix: raise CLIError on wait timeout; add unit tests Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR fixes az resource wait timeout handling by raising a CLIError instead of returning a CLIError object that callers discard, ensuring timeouts fail with a non-zero exit code and an error message.
Changes:
- Change
WaitCommandOperation.waittimeout path fromreturn CLIError(...)toraise CLIError(...). - Add unit tests verifying timeout raises
CLIErrorand successful waits returnNone.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/azure-cli-core/azure/cli/core/commands/command_operation.py | Fixes timeout path to raise an error so az resource wait correctly fails on timeout. |
| src/azure-cli-core/azure/cli/core/tests/test_wait_command_operation.py | Adds regression tests for timeout/error behavior and successful return behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @@ -458,7 +458,7 @@ def wait(cls, command_args, cli_ctx, getter): | |||
| time.sleep(interval) | |||
| with self.assertRaises(CLIError) as ctx: | ||
| WaitCommandOperation.wait(command_args, cli_ctx=cli_ctx, getter=getter) |
Live test skipped⏭️ Skipping the live test for this revision because the only test file(s) changed are These |
|
Resource |
There was a problem hiding this comment.
Automated Review Summary — PASS
CI: 19/19 completed checks passed, 0 failed. 3 checks
(Azure.azure-cli Breaking Change Test, Azure.azure-cli Full Test,
Azure.azure-cli) have been stuck in queued for ~198 minutes, well past the
180-minute abandoned threshold. A re-trigger attempt (rerun_stale_pr_checks)
returned 0 re-requested (cooldown or provider refusal), so these are treated
as zombie/abandoned checks rather than blocking failures. No completed check
has failed.
Live test: Skipped — the PR only changes
src/azure-cli-core/azure/cli/core/commands/command_operation.py and a new
unit test test_wait_command_operation.py; azure-cli-core unit tests are
not runnable via azdev test --live.
Regression coverage: Not applicable — the change is in azure-cli-core
infrastructure code, not a command module, so the module-coverage gap check
does not apply.
Review-skill findings: None. Reviewed against test-strength and
scope-consistency checks:
- The change is a single-line fix (
return CLIError(...)→raise CLIError(...)) inWaitCommandOperation.wait, matching the PR title/issue
scope exactly (az resource waitraising instead of returning on timeout). - The added unit test
test_wait_command_operation.pyasserts
WaitCommandOperation.waitraisesCLIErroron timeout
(test_wait_raises_on_timeout) and still returnsNoneon the success path
(test_wait_returns_none_on_success) — both assertions can fail if the
implementation regresses, and the negative/timeout path is exercised.
Recommendation: No source changes requested. A maintainer may want to
manually re-run or inspect the 3 stuck Azure DevOps checks before merge, since
Azure Client Tools Agent could not re-trigger them, but nothing indicates a
PR-related failure.
|
🔔 Routing this PR to @Azure/act-identity-squad. |
Description
Fixes #34004.
Related command
az resource wait(and all subcommands sharingWaitCommandOperation)Description
WaitCommandOperation.waitwas usingreturn CLIError(...)on timeout instead ofraise CLIError(...). The return value was silently discarded by callers, causing timed-out waits to exit with code 0 and no error output — indistinguishable from success.command_operation.py:return CLIError(...)→raise CLIError(...)at timeout pathtest_wait_command_operation.py(new): unit tests assertingCLIErroris raised on timeout andNoneis returned on successTesting Guide
Unit tests added to
src/azure-cli-core/azure/cli/core/tests/test_wait_command_operation.py.History Notes
[Core]
az resource wait: Fix timeout path to raiseCLIErrorinstead of silently returning it