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
Conversation
a5c33e1 to
d265f7a
Compare
browndav-msft
commented
May 7, 2026
| /** | ||
| * Range download without content validation works correctly. | ||
| */ | ||
| @Test |
Member
Author
There was a problem hiding this comment.
Deleted this test since it is covered by other tests that should fail if CV disabled causes issues with normal downloads.
Contributor
There was a problem hiding this comment.
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
hasStructuredMessageDownloadResponseHeadershelper). - 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update tests to check for content-validation response headers