Skip to content

[Storage Mover] Adding scenario tests#47025

Open
sssash18 wants to merge 8 commits into
mainfrom
fix/storagemover-tests
Open

[Storage Mover] Adding scenario tests#47025
sssash18 wants to merge 8 commits into
mainfrom
fix/storagemover-tests

Conversation

@sssash18
Copy link
Copy Markdown
Member

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Suyash Choudhary and others added 4 commits May 20, 2026 14:45
- Introduced async test suite for job runs operations, verifying list and get functionalities.
- Added sync test suite for job runs operations with similar coverage.
- Created async and sync tests for project operations, including create, get, update, and delete scenarios.
- Implemented async and sync tests for storage mover operations, covering create, update, get, and delete functionalities.
- Removed outdated async and sync operation tests that were not aligned with the new structure.
- Update asset tag in assets.json for versioning.
- Enhance test sanitizers in conftest.py to avoid clobbering non-sensitive fields.
- Skip agent-related tests that require a registered VM.
- Modify job definition tests to accept scheduling variables for better flexibility.
- Adjust assertions in storage mover tests to focus on specific tags rather than total counts.
…ic and private sources in Storage Mover

- Added async test for starting a CloudToCloud job with a public AWS S3 bucket as the source.
- Implemented async test for starting a CloudToCloud job with a private AWS S3 bucket, including connection approval and RBAC setup.
- Enhanced existing tests to provision necessary resources and validate job execution status.
- Updated role assignment and resource cleanup logic to ensure proper teardown after tests.
Adds azure-mgmt-network, azure-mgmt-authorization, and azure-mgmt-storage
as test-only dependencies. These are required by the cross-subscription
flow exercised by matrix row #31 (test_start_c2c_job_with_private_source)
and row #10's extended public-bucket E2E (test_job_definition_job_run):
PE-connection approval on the shared PrivateLinkService, blob container
provisioning under the shared storage account, and Storage Blob Data
Contributor role assignment for the target endpoint MSI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 20, 2026 09:40
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 expands azure-mgmt-storagemover management-plane test coverage by replacing the prior generated “operations.list” tests with a broader set of scenario-style tests covering Storage Mover resources and related sub-resources (projects, endpoints, connections, job definitions/job runs), including both sync and async variants. It also updates test-proxy sanitization and adds test-only dependencies needed for cross-subscription scenarios.

Changes:

  • Added new scenario test modules for endpoints, projects, connections, job definitions, job runs, and agents (sync + async).
  • Refactored existing storage mover tests into scenario CRUD-style tests (sync + async).
  • Updated test-proxy sanitizers + added cross-subscription mgmt client deps; added assets.json; removed the standalone operations-list test modules.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_storage_movers_operations_test.py Replaced minimal list tests with StorageMover CRUD + related scenario checks (sync).
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_storage_movers_operations_async_test.py Async mirror of StorageMover scenario CRUD tests.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_projects_operations_test.py New project CRUD/list/exists scenario coverage (sync).
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_projects_operations_async_test.py Async mirror of project scenario tests.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_endpoints_operations_test.py New endpoint scenario coverage across endpoint types + kind validation (sync).
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_endpoints_operations_async_test.py Async mirror of endpoint scenario tests.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_connections_operations_test.py New connection CRUD/list/update/delete scenario coverage (sync).
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_connections_operations_async_test.py Async mirror of connection scenario tests.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_job_definitions_operations_test.py New job definition schedule scenarios + cloud-to-cloud job-run scenarios (sync).
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_job_definitions_operations_async_test.py Async mirror of job definition/job-run scenarios.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_job_runs_operations_test.py Adds read-only job run list/get coverage for non-agent environments (sync).
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_job_runs_operations_async_test.py Async mirror of job run read-only coverage.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_agents_operations_test.py Adds (skipped) agent get/list/update coverage requiring a registered agent VM (sync).
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_agents_operations_async_test.py Async mirror of (skipped) agent coverage.
sdk/storagemover/azure-mgmt-storagemover/tests/conftest.py Adds/removes test-proxy sanitizers to support new assertions and cross-sub scenarios.
sdk/storagemover/azure-mgmt-storagemover/dev_requirements.txt Adds test-only deps for network/authorization/storage mgmt clients used in scenarios.
sdk/storagemover/azure-mgmt-storagemover/assets.json Points recordings to the azure-sdk-assets repo/tag.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_operations_test.py Removed standalone sync operations-list test.
sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_operations_async_test.py Removed standalone async operations-list test.
Comments suppressed due to low confidence (4)

sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_job_definitions_operations_test.py:22

  • HttpResponseError is imported but never used in this test module. Please remove it to avoid unused-import lint failures.
import pytest
from azure.core.exceptions import HttpResponseError
from azure.mgmt.authorization.v2022_04_01 import AuthorizationManagementClient
from azure.mgmt.network import NetworkManagementClient

sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_job_definitions_operations_async_test.py:22

  • HttpResponseError is imported but never used in this test module. Please remove it to avoid unused-import lint failures.
import pytest
from azure.core.exceptions import HttpResponseError
from azure.mgmt.authorization.v2022_04_01.aio import AuthorizationManagementClient
from azure.mgmt.network.aio import NetworkManagementClient

sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_endpoints_operations_test.py:238

  • The comment "Running it anyway as the user asked" reads like conversational context and isn’t actionable/portable in the repo. Please reword this note to be neutral (e.g., explain why the test is included despite .NET ignoring it) and consider marking it skipped if it can’t be reliably recorded/live-run with placeholder credentials.
    # ----- EndpointTests.S3WithHmacEndpointCreateGetDeleteTest -----
    # NOTE: .NET marks this [Ignore] ("requires live S3 resources that are not yet
    # available for recording"). Running it anyway as the user asked — the request
    # uses placeholder URIs/credentials, so the RP may reject them.

sdk/storagemover/azure-mgmt-storagemover/tests/test_storage_mover_mgmt_endpoints_operations_async_test.py:219

  • The comment "Running it anyway as the user asked" reads like conversational context and isn’t actionable/portable in the repo. Please reword this note to be neutral (e.g., explain why the test is included despite .NET ignoring it) and consider marking it skipped if it can’t be reliably recorded/live-run with placeholder credentials.
    # ----- EndpointTests.S3WithHmacEndpointCreateGetDeleteTest -----
    # NOTE: .NET marks this [Ignore] ("requires live S3 resources that are not yet
    # available for recording"). Running it anyway as the user asked — the request
    # uses placeholder URIs/credentials, so the RP may reject them.

Comment on lines +6 to +8
"""Sync scenario tests for storage movers (provider operations + StorageMover CRUD).

Mirrors .NET StorageMoverCollectionTests + StorageMoverResourceTests at:
"""Sync scenario tests for storage movers (provider operations + StorageMover CRUD).

Mirrors .NET StorageMoverCollectionTests + StorageMoverResourceTests at:
Q:\\source\\azure-sdk-for-net\\sdk\\storagemover\\Azure.ResourceManager.StorageMover\\tests\\Scenario
Comment on lines +6 to +10
"""Async scenario tests for storage movers (provider operations + StorageMover CRUD).

Mirrors .NET StorageMoverCollectionTests + StorageMoverResourceTests at:
Q:\\source\\azure-sdk-for-net\\sdk\\storagemover\\Azure.ResourceManager.StorageMover\\tests\\Scenario
"""
"""Async scenario tests for storage movers (provider operations + StorageMover CRUD).

Mirrors .NET StorageMoverCollectionTests + StorageMoverResourceTests at:
Q:\\source\\azure-sdk-for-net\\sdk\\storagemover\\Azure.ResourceManager.StorageMover\\tests\\Scenario
"""Sync scenario tests for projects.

Mirrors .NET ProjectCollectionTests + ProjectResourceTests at:
Q:\\source\\azure-sdk-for-net\\sdk\\storagemover\\Azure.ResourceManager.StorageMover\\tests\\Scenario
Comment on lines +6 to +14
"""Async scenario tests for job_definitions.

Mirrors .NET JobDefinitionJobRunTests + JobDefinitionScheduleTests at:
Q:\\source\\azure-sdk-for-net\\sdk\\storagemover\\Azure.ResourceManager.StorageMover\\tests\\Scenario

Also implements cross-language matrix row #31
(`JobDefinitionJobRunTests.StartC2CJobWithPrivateSourceTest`) — see the sync
sibling file for the full rationale.
"""
"""Sync scenario tests for endpoints.

Mirrors .NET EndpointTests at:
Q:\\source\\azure-sdk-for-net\\sdk\\storagemover\\Azure.ResourceManager.StorageMover\\tests\\Scenario\\EndpointTests.cs
"""Async scenario tests for endpoints.

Mirrors .NET EndpointTests at:
Q:\\source\\azure-sdk-for-net\\sdk\\storagemover\\Azure.ResourceManager.StorageMover\\tests\\Scenario\\EndpointTests.cs
storage_mover={"location": AZURE_LOCATION},
)

# ----- ProjectCollectionTests.CrateGetExistTest -----
assert result == []
assert project.name == project_name

# ----- StorageMoverResourceTests.UpdateAddSetRemoveTagDeletTest -----
Suyash Choudhary and others added 4 commits May 20, 2026 16:20
…ncy)

Two CI failures from PR #47025:

1. Playback body mismatch on the regular Build Test legs: the custom
   cross-sub sanitizer rewrote the source literal b6b34ad8-... to
   1111111-..., but the cassette already had 00000000-... (default
   AZURE_SUBSCRIPTION_ID sanitizer ran first at record time). Change
   the custom sanitizer target to 00000000-... so both sanitizers
   agree, no re-record needed. Also align role-assignment-GUID and
   principalId sanitizers to the same canonical value.

2. Collection error on mindependency/sdist legs: 'No module named
   azure.mgmt.storage.aio' — old floor-pinned azure-mgmt-storage
   lacks the .aio submodule. Guard the .aio imports in the async
   test file with pytest.importorskip so the module is skipped
   cleanly in that environment instead of failing collection.

Local validation: full suite 60 PASS / 4 SKIP / 26s in playback with
no AZURE_SUBSCRIPTION_ID env set (mimics CI).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build 6327088 showed test_job_definition_job_run and
test_start_c2c_job_with_private_source still failing on the
mindependency leg with 'msrestazure.azure_exceptions.CloudError:
InvalidAuthenticationToken'. Root cause: the floor-pinned
azure-mgmt-storage (v2019_06_01) uses msrestazure transport which
bypasses azure-core's RequestsTransport, and therefore the
test-proxy, hitting live ARM instead of replaying the cassette.

Detect the modernization line via the presence of the .aio submodule
on azure-mgmt-storage/-network plus the v2022_04_01 namespace on
azure-mgmt-authorization, and gate both cross-sub sync tests behind
a pytest.mark.skipif that triggers when those signals are absent.
The matrix-#11/#12/#13 schedule tests in the same file (which do not
use cross-sub clients) are unaffected and continue to run in
mindependency.

The cross-sub imports themselves are now wrapped in try/except so the
module collects cleanly when those packages are too old to even
provide the symbols (otherwise mindependency would fail on the
from-import line before the skipif could fire).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build 6327280 reproduced a new failure mode on the whl + sdist CI legs
(mindependency now passes after the previous skip-marker landed):

  Playback failure -- Uri doesn't match:
    request <...?api-version=2025-08-01>
    record  <...?api-version=2025-06-01>

Root cause: my local recording environment had azure-mgmt-storage
24.0.1 (default api-version 2025-06-01); CI's whl/sdist venvs pull
the latest released azure-mgmt-storage 25.0.0 (default 2025-08-01).
URL mismatch -> cassette miss -> proxy returns 404.

Pin api_version explicitly on the cross-sub clients to the versions
captured in the recordings:
  - StorageManagementClient    -> '2025-06-01'
  - NetworkManagementClient    -> '2025-05-01'
  - AuthorizationManagementClient already pinned via the
    v2022_04_01 namespace import (no kwarg needed)

Applied to all 4 affected test methods (sync + async * #10 + #31).
The recordings themselves are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants