Repository navigation
[MySQL] az mysql flexible-server rename: Add server rename support (preview) - #34240
Aayush Gupta (AAGUPTA6209) wants to merge 1 commit into
Conversation
Add a preview rename command that validates the destination name, submits the service request, and returns the initial response and operation URL without polling. Document the workflow and add unit and opt-in live coverage.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution Aayush Gupta (@AAGUPTA6209)! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
🔵 Needs a closer look
The resource identity change warrants human review, especially because the opt-in live scenarios remain unexecuted.
No open issues 🎉
What changed in this PR
Adds preview support for az mysql flexible-server rename within the existing MySQL command module.
Changes:
- Registers the command with confirmation, source validation, and destination-name validation.
- Submits rename requests and returns the initial response without polling.
- Adds help, mocked tests, and opt-in live scenarios.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_flexible_server_rename.py | Tests requests, validation, responses, and CLI behavior. |
| src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_flexible_server_rename_live.py | Adds standalone, HA, and replication live scenarios. |
| src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_custom.py | Extends the argument-registration test helper. |
| src/azure-cli/azure/cli/command_modules/mysql/custom.py | Implements rename submission and initial-response output. |
| src/azure-cli/azure/cli/command_modules/mysql/commands.py | Registers the preview command and confirmation prompt. |
| src/azure-cli/azure/cli/command_modules/mysql/_validators.py | Validates source resource IDs. |
| src/azure-cli/azure/cli/command_modules/mysql/_params.py | Adds destination-name and compatibility arguments. |
| src/azure-cli/azure/cli/command_modules/mysql/_help.py | Documents usage, operational risks, and completion monitoring. |
Review effort: Balanced
|
Hi Aayush Gupta (@AAGUPTA6209), |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Aayush Gupta (@AAGUPTA6209) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
🤖 PR Validation —⚠️ Review suggested
Related command
az mysql flexible-server renameDescription
Add a preview command to rename an existing Azure Database for MySQL flexible server within the same subscription, resource group, and location.
Implementation
az mysql flexible-server renameas a preview command with a confirmation prompt and--yessupport.--new-nameargument.--resource-groupand--name, or a single MySQL flexible server resource ID through--ids.createMode: Rename, its canonical resource ID, and its existing location.statusCode: initial HTTP status.content: initial response body as text.azureAsyncOperation: operation-status URL from the response header, ornullif absent.--no-waitfor compatibility. Submission-only behavior and output are the same with or without this flag.No SDK dependency or API-version change is introduced by this PR.
Behavior and prerequisites
Testing Guide
Local automated validation
$Pythonbelow refers to the source-linked development Python executable.Style checks
Result: PASS — Pylint and Flake8.
CLI command/help linter
Result: PASS — no command/help or custom Pylint violations at the default severity threshold.
The GitHub workflow additionally specifies
--min-severity medium; that stricter configuration was not run locally.Focused rename and regression tests
Result: PASS — 56 tests collected, 52 passed, 4 opt-in live tests skipped.
Coverage includes request serialization, canonical source IDs, initial response preservation, default and
--no-waitbehavior, name validation, resource ID validation, confirmation handling, service errors, transport failures, and timeouts.Full MySQL regression suite
Executed full unittest discovery through an offline harness that verified recordings existed for active scenarios and blocked live network connections.
Result: 89 tests collected: 78 passed, 10 skipped, 1 error.
The error occurred in the existing Windows test
TestWindowsExecutableResolution.test_real_launch_ignores_current_directory_executable:Investigation reproduced the error using only existing tests unchanged by this PR. Scenario-test cleanup replaces Windows' case-insensitive
os.environmapping with a plain dictionary, causing a subsequent mixed-caseSystemRootlookup to fail.Reran the affected utility-test module in a fresh process:
Result: PASS — all 23 tests passed, including the test that failed after scenario execution.
No unrelated test-framework changes were made. The combined local full-suite run is not being reported as passing.
Whitespace validation
Result: PASS.
Manual live validation
Manual replica-rename validation completed successfully using the local CLI against a rename-enabled canary environment.
This result does not establish support for every topology or region, or verify data-plane continuity.
Manual reproduction
Use an approved test server in a rename-enabled environment. These commands operate on real Azure resources.
Inspect the source:
Submit the rename and review the confirmation prompt:
Poll the returned operation URL:
Repeat the GET while the operation is in progress. Stop and investigate if it fails or is canceled. Do not resubmit rename merely because completion is pending.
After
Succeeded, inspect the destination:Verify the new name, resource ID, endpoint, and
Readystate. For a replica, verify the source-server reference.Verify the old identity no longer resolves:
Expected result:
ResourceNotFound.Coverage limitations
LiveScenarioTest; they are not recorded playback scenarios and should not be assumed to run in normal PR CI.History Notes
[MySQL]
az mysql flexible-server rename: Add server rename support (preview)This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.