Skip to content

[HorizonDB] Add failover command - #10607

Open
Gabriel Lobo (thegabrielobo) wants to merge 1 commit into
Azure:mainfrom
thegabrielobo:agents/ado-5812512-horizondb-failover-command
Open

Gabriel Lobo (thegabrielobo) wants to merge 1 commit into
Azure:mainfrom
thegabrielobo:agents/ado-5812512-horizondb-failover-command

Conversation

@thegabrielobo

@thegabrielobo Gabriel Lobo (thegabrielobo) commented Nov 20, 2026 •

Copy link
Copy Markdown

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Suppressions
⚠️ None ️✔️ None
⚠️Azure CLI Extensions Breaking Change Test
⚠️horizondb
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd horizondb cluster failover cmd horizondb cluster failover added

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az horizondb cluster failover

Generated from: Azure/aaz#1176

ADO 5812512: https://dev.azure.com/msdata/5603b9e3-ece0-4518-b9c8-1a36054d9970/_workitems/edit/5812512

Description

Adds az horizondb cluster failover using the bodyless Clusters_Failover POST action in API 2026-10-01-preview.

  • Waits for service-selected failover to complete and returns the updated Cluster.
  • Supports standard name/resource-group/subscription/resource-ID selectors and --no-wait.
  • Propagates service eligibility/conflict, polling and final-result errors.
  • Does not add pool, target-node, zone, mode or --yes inputs, or custom runtime orchestration.

Bumps the extension version from 1.0.0b9 to 1.0.0b10 and documents the change in HISTORY.rst / README.md.

Testing

  • azdev style horizondb - PASSED (pylint and flake8).
  • azdev linter horizondb - PASSED (standard rules and custom pylint rules).
  • azdev scan --file-path <file> for each of the eight committed extension files - PASSED: no secrets detected.
  • python scripts\ci\test_index.py -q - PASSED: 9 tests run, including 2 CI-only skips.
  • python -m pytest src\horizondb\azext_horizondb\tests\latest\unittest_cluster_failover.py -q --disable-warnings --tb=short - PASSED: 11 tests, 23 subtests. Mocked HTTP covers bodyless POST/API version, selectors, default LRO waiting, final Cluster output, --no-wait and errors.
  • python <task-files>\validate_failover_offline.py (task-local socket-blocked runner) - PASSED: 65 tests, 145 subtests, zero skips. Includes 63 unit tests and both recorded Cluster management/failover scenarios.
  • python <task-files>\record_failover.py --subscription <approved-subscription> --resource-group <approved-existing-rg> --cluster <approved-new-cluster> --pool <approved-new-pool> --existing-resource-group - PASSED: 1 live scenario, zero failures/errors/skips; 969.439 seconds.
  • python <task-files>\audit_failover_recording.py <recording> - PASSED: 33 authentic interactions; supplemental local privacy inspection passed. No response semantics were edited.
  • python <task-files>\validate_failover_offline.py --failover-only - PASSED: 1 authentic playback scenario, zero skips, with socket connections blocked.
  • With $env:AZURE_TEST_RUN_LIVE='false', azdev test test_horizondb_cluster_failover --series --xml-path <results-dir>\failover-azdev-playback.xml - PASSED: 1 playback scenario, zero skips.
  • aaz-dev command-model verify --aaz-path <aaz-checkout> --target horizondb and task-local exact model-to-code/XML export verification - PASSED; existing command/wait selections preserved.

HorizonDBClusterFailoverScenarioTest checks pool provisioning/designation, executes failover with default waiting, checks the returned Cluster and a subsequent show, then deletes the disposable Cluster. Its operations and assertions run in both live and playback modes. The authentic fixture records one bodyless POST accepted with 202, monitor polling, and a final Location GET returning the Ready/Succeeded Cluster. Missing playback fixtures fail before resource preparation rather than skipping or implicitly recording live. --no-wait is mocked coverage; no additional disruptive failover was performed for it.

Live recording used an isolated test-only helper to preserve the existing resource group and handle the installed Python 3.10 SDK's cassette-save bookkeeping defect. The first operator-run scenario passed but lost its cassette; the explicitly approved additional run retained the authentic recording and verified playback. No shared SDK or extension runtime patch was made. Cleanup of only the new test Cluster was verified.

Full-repository tests and remote CI were not run locally.

The existing shell hooks were invoked but returned early because their shared Python/discovery configuration did not recognize the isolated worktree. Secret scanning, style and linter checks were run independently and passed; no --no-verify or shared-hook/configuration changes were used.

History Notes

  • Add support for service-selected failover through az horizondb cluster failover, with default waiting, updated Cluster output and --no-wait.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
    • azdev style horizondb: passed.
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
    • python scripts\ci\test_index.py -q: passed, including 2 CI-only skips.
  • My extension version conforms to the Extension version schema
    • Additive preview feature: 1.0.0b9 -> 1.0.0b10.

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Add the bodyless cluster failover LRO for API 2026-10-01-preview,
with standard selectors, default waiting and no-wait support.
Include focused unit coverage, authentic recorded playback and documentation.

ADO 5812512.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 08:39
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Nov 20, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Gabriel Lobo (@thegabrielobo)! We will review the pull request and get back to you soon.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The PR description still lacks the actual Azure/aaz model PR link, preventing reviewers from verifying the generated command, arguments, API version, and LRO configuration against its source model.

1 open issue
What changed in this PR

Adds az horizondb cluster failover to the HorizonDB extension for service-selected failover within a cluster’s designated read-write pool.

Changes:

  • Adds a bodyless failover action using API 2026-10-01-preview, with default waiting, updated Cluster output, and --no-wait support.
  • Adds mocked command tests and a failover scenario covering pool setup, completion, and cluster state.
  • Documents usage and recording precautions, and bumps the extension to 1.0.0b10.
File Description
src/​horizondb/​setup.py Bumps the extension version to 1.0.0b10.
src/​horizondb/​README.md Documents failover usage and scenario-test procedures.
src/​horizondb/​HISTORY.rst Adds failover release notes.
src/​horizondb/​azext_horizondb/​tests/​latest/​unittest_cluster_failover.py Tests selectors, requests, polling, output, and error propagation.
src/​horizondb/​azext_horizondb/​tests/​latest/​test_horizondb_cluster.py Adds a failover scenario and missing-recording guard.
src/​horizondb/​azext_horizondb/​aaz/​latest/​horizondb/​cluster/​_failover.py Implements the generated failover command.
src/​horizondb/​azext_horizondb/​aaz/​latest/​horizondb/​cluster/​__init__.py Imports the new command for registration.

Review effort: Balanced

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants