Skip to content

Storage Content Validation - Assert Request and Response Headers for Decoder Tests#49075

Open
browndav-msft wants to merge 8 commits intoAzure:feature/storage/content-validationfrom
browndav-msft:feature/storage/content-validation/add-content-validation-tests
Open

Storage Content Validation - Assert Request and Response Headers for Decoder Tests#49075
browndav-msft wants to merge 8 commits intoAzure:feature/storage/content-validationfrom
browndav-msft:feature/storage/content-validation/add-content-validation-tests

Conversation

@browndav-msft
Copy link
Copy Markdown
Member

Update tests to check for content-validation response headers

@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label May 6, 2026
@ibrandes ibrandes changed the title Feature/storage/content validation/add content validation tests Storage Content Validation - Assert Request and Response Headers for Decoder Tests May 6, 2026
@ibrandes ibrandes marked this pull request as ready for review May 6, 2026 18:03
@browndav-msft browndav-msft force-pushed the feature/storage/content-validation/add-content-validation-tests branch from a5c33e1 to d265f7a Compare May 7, 2026 01:06
/**
* Range download without content validation works correctly.
*/
@Test
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Deleted this test since it is covered by other tests that should fail if CV disabled causes issues with normal downloads.

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 Azure Storage Blob content-validation decoder tests to assert that structured-message content validation is being requested and acknowledged via request/response headers.

Changes:

  • Refactors sync and async download decoder tests to record request headers and assert structured-message request headers are present when content validation is enabled.
  • Adds response-header assertions for structured-message downloads (via new hasStructuredMessageDownloadResponseHeaders helper).
  • Introduces a reusable pipeline policy helper (getRequestAndResponseHeaderSniffer) to capture both request and response headers for targeted download calls.

Reviewed changes

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

File Description
sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobTestBase.java Adds header validation helpers and a pipeline policy to record request/response headers for decoder tests.
sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobContentValidationDownloadTests.java Refactors sync decoder tests to assert structured-message request/response headers and reuse shared sniffing utilities.
sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobContentValidationAsyncDownloadTests.java Refactors async decoder tests to assert structured-message request/response headers; removes the prior async range-download test.

Comment on lines +1402 to +1404
.equalsIgnoreCase(headers.getValue(Constants.HeaderConstants.STRUCTURED_BODY_TYPE_HEADER_NAME));
}

Comment on lines 201 to +206
/**
* Default behavior: when no algorithm is specified, default is NONE (no validation).
*/
@Test
public void downloadStreamDefaultAlgorithmIsNone() {
byte[] data = getRandomByteArray(TEN_MB);
List<HttpHeaders> recorded = new CopyOnWriteArrayList<>();
BlobAsyncClient downloadClient = createBlobAsyncClientWithRequestSniffer(recorded);
data = getRandomByteArray(TEN_MB);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants