Skip to content

Conversation

@vincenttran-msft
Copy link
Member

@vincenttran-msft vincenttran-msft commented Nov 11, 2025

This test does the following:

  • Adds set_legal_hold API to BlobClient
  • Adds a way to specify "playback only" in Azure Core test macros

SetLegalHold:

/// * date() - Date REMOVED
/// * legal_hold() - x-ms-legal-hold REMOVED

  • Changelog Entry

…ount type, update azure_core to allow for playback-only mcaro
@github-actions github-actions bot added Azure.Core The azure_core crate Storage Storage Service (Queues, Blobs, Files) labels Nov 11, 2025
@github-actions
Copy link

github-actions bot commented Nov 11, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure_storage_blob

@vincenttran-msft vincenttran-msft marked this pull request as ready for review November 15, 2025 01:17
Copilot AI review requested due to automatic review settings November 15, 2025 01:17
Copilot finished reviewing on behalf of vincenttran-msft November 15, 2025 01:19
Copy link
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 adds support for the set_legal_hold API to BlobClient and introduces a "playback only" option for test macros to support tests that can only run in playback mode.

Key Changes:

  • Adds set_legal_hold() method to BlobClient for setting or removing legal holds on blobs
  • Implements #[recorded::test(playback)] attribute for tests that should only run during playback
  • Updates TypeSpec commit reference to include the latest blob storage API specifications

Reviewed Changes

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

Show a summary per file
File Description
sdk/storage/azure_storage_blob/tsp-location.yaml Updates TypeSpec commit reference to newer version
sdk/storage/azure_storage_blob/tests/blob_client.rs Adds comprehensive test for set_legal_hold API marked as playback-only
sdk/storage/azure_storage_blob/src/models/mod.rs Updates public exports to include BlobClientSetLegalHoldOptions
sdk/storage/azure_storage_blob/src/generated/models/pub_models.rs Removes unused result types and changes AccessPolicy date fields from OffsetDateTime to String
sdk/storage/azure_storage_blob/src/generated/models/models_impl.rs Adds TryFrom implementation for SignedIdentifiers to support XML serialization
sdk/storage/azure_storage_blob/src/generated/models/header_traits.rs Removes header traits for deleted result types and refactors SignedIdentifier handling
sdk/storage/azure_storage_blob/src/generated/clients/blob_container_client.rs Updates get_access_policy and set_access_policy to use SignedIdentifiers wrapper type
sdk/storage/azure_storage_blob/src/generated/clients/blob_client.rs Updates set_legal_hold to return Response<(), NoFormat> instead of custom result type
sdk/storage/azure_storage_blob/src/clients/blob_client.rs Adds public set_legal_hold method to non-generated BlobClient wrapper
sdk/storage/azure_storage_blob/assets.json Updates test asset tag reference
sdk/storage/azure_storage_blob/CHANGELOG.md Documents addition of set_legal_hold API
sdk/core/azure_core_test_macros/src/test.rs Implements playback-only test functionality with validation and tests

Comment on lines +53 to +58
// Ignore playback-only tests if not running playback tests.
if recorded_attrs.playback && test_mode != TestMode::Playback {
test_attr.extend(quote! {
#[ignore = "skipping playback-only tests"]
});
}
Copy link
Member

Choose a reason for hiding this comment

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

What's the use case for this? How do you record this in the first place then? If you don't need a recording, don't use #[recorded::test]. Use a normal #[tokio::test].

Copy link
Member Author

Choose a reason for hiding this comment

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

I ran it first with #[recorded::test] and AZURE_TEST_MODE=record, to generate the initial recording, then I marked it as #[recorded::test(playback)] so that this test will not execute in the live test pipeline and only in playback mode.

Copy link
Member

Choose a reason for hiding this comment

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

I understand what it does. I'm asking: why? You can use mock tests. This feels like a lot of work to re-record tests and I don't necessarily want to support a "record-only" concept for other services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Core The azure_core crate Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants