Skip to content

Fix/mlv2 tests record only#9877

Open
lavakumarrepala wants to merge 2 commits into
Azure:mainfrom
Chakradhar886:fix/mlv2-tests-record-only
Open

Fix/mlv2 tests record only#9877
lavakumarrepala wants to merge 2 commits into
Azure:mainfrom
Chakradhar886:fix/mlv2-tests-record-only

Conversation

@lavakumarrepala
Copy link
Copy Markdown
Member


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

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

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.

test_capability_host_in_hub and test_capability_host_in_project use hardcoded resource group 'testrg' and workspace 'workspace' that only exist in the recorded cassette. Running live raises ResourceGroupNotFound. Mark them with @record_only() and document why.
Many tests in machinelearningservices/azext_mlv2/tests/latest reference hardcoded resource groups (testrg, test-rg-000006, test-cli-rg), workspaces (testworkspace), or registries (test-cli-reg, testFeed, bani-reg-wentral) that only exist in their recorded cassettes. Running them in --live mode raises ResourceGroupNotFound, ResourceNotFound, or AuthorizationFailed.

Add @record_only() to those tests (and import the decorator) so they are skipped in live mode and continue to pass via cassette playback. Also document the rationale in a comment above each decorator.
Copilot AI review requested due to automatic review settings May 15, 2026 16:57
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @lavakumarrepala,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 15, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown
Contributor

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the azext_mlv2 scenario test suite to run in recording/playback-only mode by adding the @record_only() decorator to tests that depend on hardcoded, pre-existing resources (for example the testrg resource group) that are only present in the recorded cassettes.

Changes:

  • Added @record_only() to many MLv2 scenario tests to prevent live execution failures due to hardcoded resources.
  • Standardized test behavior rationale via inline comments and added the required record_only imports.
  • Cleaned up a couple of file headers (removed BOM) and fixed a hardcoded CLI arg typo in a capability-host test command.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/machinelearningservices/azext_mlv2/tests/latest/test_workspace_scenarios.py Adds record_only usage for workspace tests (but one decorator was added inside a docstring block).
src/machinelearningservices/azext_mlv2/tests/latest/test_registry_scenarios.py Marks registry scenario tests as record-only due to hardcoded RG usage.
src/machinelearningservices/azext_mlv2/tests/latest/test_online_endpoint_scenarios.py Marks online endpoint scenario tests as record-only to avoid live failures against hardcoded resources.
src/machinelearningservices/azext_mlv2/tests/latest/test_model_scenarios.py Marks model scenario tests as record-only because they reference hardcoded test resources.
src/machinelearningservices/azext_mlv2/tests/latest/test_k8s_online_endpoint_scenarios.py Marks AKS/K8S online endpoint tests as record-only.
src/machinelearningservices/azext_mlv2/tests/latest/test_job_scenarios.py Marks job scenario tests as record-only due to hardcoded RG/workspace dependencies.
src/machinelearningservices/azext_mlv2/tests/latest/test_feature_store_scenarios.py Marks feature store tests as record-only due to hardcoded resources.
src/machinelearningservices/azext_mlv2/tests/latest/test_feature_store_entity_scenarios.py Marks feature store entity tests as record-only due to hardcoded resources.
src/machinelearningservices/azext_mlv2/tests/latest/test_feature_set_scenarios.py Removes BOM from header and marks feature set test as record-only.
src/machinelearningservices/azext_mlv2/tests/latest/test_environment_scenarios.py Marks most environment tests as record-only due to hardcoded resources/registry usage.
src/machinelearningservices/azext_mlv2/tests/latest/test_deployment_template_scenarios.py Removes BOM from header and marks deployment-template workflow tests as record-only.
src/machinelearningservices/azext_mlv2/tests/latest/test_datastore_scenarios.py Marks datastore scenario tests as record-only due to hardcoded RG helper usage.
src/machinelearningservices/azext_mlv2/tests/latest/test_compute_scenarios.py Marks compute scenario tests as record-only (with repeated per-test annotations).
src/machinelearningservices/azext_mlv2/tests/latest/test_component_scenarios.py Marks component tests as record-only to avoid live failures against hardcoded resources.
src/machinelearningservices/azext_mlv2/tests/latest/test_capability_host_scenarios.py Marks capability-host tests as record-only and fixes a hardcoded command arg typo.
src/machinelearningservices/azext_mlv2/tests/latest/test_batch_endpoint_scenarios.py Removes BOM from header and marks batch endpoint tests as record-only.

Comment on lines 16 to 22
class WorkspaceScenarioTest(MLBaseScenarioTest):
'''
# Marked as record_only because the test uses hardcoded resource group
# 'testrg', which only exists in the recorded cassette. Running live
# raises ResourceGroupNotFound or AuthorizationFailed.
@record_only()
def test_workspace(self) -> None:
Comment on lines 17 to 22
class ComputeScenarioTest(MLBaseScenarioTest):
# Marked as record_only because the test uses hardcoded resource group
# 'testrg', which only exists in the recorded cassette. Running live
# raises ResourceGroupNotFound or AuthorizationFailed.
@record_only()
def test_compute_aml(self) -> None:
@yonzhan yonzhan requested a review from necusjz May 15, 2026 23:25
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.

5 participants