Skip to content

Storage Content Validation - Fuzzy Upload Tests#49031

Merged
ibrandes merged 11 commits into
Azure:feature/storage/content-validationfrom
ibrandes:content-validation/encoderFuzzyTesting
May 14, 2026
Merged

Storage Content Validation - Fuzzy Upload Tests#49031
ibrandes merged 11 commits into
Azure:feature/storage/content-validationfrom
ibrandes:content-validation/encoderFuzzyTesting

Conversation

@ibrandes

@ibrandes ibrandes commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Adds parameterized fuzzy parallel upload coverage for blob content validation: parallel uploadWithResponse with CRC64, varied payload size, segment / block size, and max concurrency, then download and byte-compare for sync (BlobClient) and async (BlobAsyncClient) paths.

Details

  • BlobTestBase: introduces shared @MethodSource streams that encode deterministic grids (non–power-of-two sizes, 4 MiB boundary cases, small/medium/large multipart stress).
  • BlobContentValidationUploadTests / BlobContentValidationAsyncUploadTests: new parameterized tests call small helpers that build ParallelTransferOptions + BlobParallelUploadOptions with CRC64 and assert round-trip integrity per tuple.
  • Replay vs live: Put Blob–friendly tuples (payload ≤ segment, no Put Block ID churn) run under the test proxy; staging / Put Block–heavy scenarios are marked @LiveOnly where recordings are unstable (e.g. random block IDs in URLs).

@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label May 3, 2026
@ibrandes ibrandes changed the title tests and assets Storage Content Validation - Fuzzy Upload Tests May 3, 2026
@ibrandes
ibrandes requested a review from Copilot May 3, 2026 17:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds deterministic, parameterized “fuzzy” parallel upload test coverage for Blob content validation using CRC64, validating round-trip integrity across varied payload sizes, segment/block sizes, and concurrency for both sync and async clients.

Changes:

  • Added shared @MethodSource argument grids in BlobTestBase to drive deterministic fuzzy upload scenarios (replayable Put Blob cases + live-only staging-heavy cases).
  • Added new parameterized CRC64 parallel upload round-trip tests for BlobClient and BlobAsyncClient.
  • Updated assets.json tag for azure-storage-blob.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.

File Description
sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobTestBase.java Introduces shared deterministic Stream<Arguments> grids for fuzzy parallel upload coverage.
sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobContentValidationUploadTests.java Adds parameterized sync fuzzy parallel upload tests + shared helper for CRC64 upload/download byte-compare.
sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobContentValidationAsyncUploadTests.java Adds parameterized async fuzzy parallel upload tests + shared helper for CRC64 upload/download byte-compare.
sdk/storage/azure-storage-blob/assets.json Updates assets tag.

@ibrandes
ibrandes marked this pull request as ready for review May 4, 2026 04:23

@gunjansingh-msft gunjansingh-msft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly all relevant cases are covered, and the overall test coverage looks good. Approving.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

@ibrandes
ibrandes requested a review from gunjansingh-msft May 12, 2026 00:14

@gunjansingh-msft gunjansingh-msft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

everything looks good. just fix the merge conflicts.

@ibrandes
ibrandes merged commit 3a287fc into Azure:feature/storage/content-validation May 14, 2026
16 of 18 checks passed
@ibrandes
ibrandes deleted the content-validation/encoderFuzzyTesting branch May 14, 2026 22:12
ibrandes added a commit that referenced this pull request Jun 23, 2026
* Crc polynomial (#43752)

* Message encoder (#43803)

* wip

* basic message encoder logic working

* removing print statements and making slightly more readable

* fixing several bugs

* adding more tests

* adding comments for building purposes and to branch off for service testing

* wip

* wip

* working encode that takes in bytebuffer

* removing redundant 'this' and making small readability changes

* fixing flag bug, adding more comments, adjusting incorrect test case

* adding structuredmessage package in implemenation and addressing other comments

* refactoring

* adding more tests, adjusting test encoder, adding more validation

* re-ordering empty buffer return

* adding correct comments

* addressing comments and fixing ci issues

* trying to resolve spotbugs issue

* formatting

* Extracting non-decoder changes from the decoder PR (#45546)

* creating class

* replacing encoder constants with new class constants

* adding fromValue to StructuredMessageFlags

* updating module info to contain more packages

* style

* undoing module info change

* Storage Content Validation - Encoder Performance Improvements (#47531)

* adjusting encoder logic

* adjusting tests to work with encoder

* addressing copilot comments

* adding more documentation

* Storage - Content Validation Public Interface (#48074)

* public facing interface wip

* adjusting output stream constructors

* removing redundant apis

* fixing pageblob api

* bloboutputstream adjustment

* wip

* wip

* importing things correctly

* formatting

* throwing error with client logger

* fixing revapi visibility increased error

* overload adjustments

* adding final to options bags and hopefully resolving revapi error

* more edits

* more edits

* more edits

* spotless

* spotless

* more edits

* removing javadoc again

* Storage - Content Validation Message Encoder Perf Updates (#47158)

* all perf adjustments

* addressing copilot comments

* Consolidate content validation types under contentvalidation package (#48272)

* Storage - Content Validation Encoder Pipeline Implementation (#48354)

* adding perf to message encoder tests

* changing package name

* changing package name

* moving checksum algorithm to new package

* wip

* moving storageschecksumalgorithm out of impl so it can actually be used

* removing unused file

* bruh

* small cleanups

* implementation for other APIs

* test updates

* undoing silly agent changes

* async tests

* perf tests for all APIs

* new path for crc64s without accessible array

* md5 compatibility tests

* progress reporter tests

* changing upload file test to stream file

* consolidating conflicting transactional checksum logic

* addressing copilot comments

* changing policy to compute crc64 header in a non-blocking manner

* fixing crc64 policy

* addressing copilot comments

* deleting perf tests

* more tests

* addressing more copilot comments

* adding recordings and marking multi part tests as live only due to the random block ids

* removing unused tests

* updating assets

* addressing github comments

* addressing comments

* renaming missed setters

* idk

* mode resolver cleanup

* adjusting mode resolver tests

* un-deprecating compute md5

* addressing API view comments

* addressing comments

* swapping test behavior for new md5 compatibility util

* wip

* adding validation to prevent progress listener being used with content val

* adding comment about flux.generate in encoder class

* adding recordings

* removing unused imports

* Storage - Content Validation Decoder Implementation (#47016)

* adding the StructuredMessageDecoder

* adding the pipeline policy changes

* smart retry changes

* fixing smart retry impl

* smart retry changes

* smart retry changes

* smart retry changes

* smart retry changes

* adding content validation tests

* code refactoring

* fixing errors i introduced :(

* addressing review comments

* code refactoring based on latest review comments

* code refactoring based on latest review comments

* simplifying retry mechanism

* removing dead code

* addressing Kyle's review comments

* addressing latest review comments

* refactoring based on latest review comments

* refactoring based on latest review comments

* refactoring based on latest review comments

* refactoring based on latest review comments from kyle

* expanding test coverage

* removing unused imports

* recordings

* adding documentation to decoder classes

* small fixes and failure path tests

* addressing context comment

* analyze error

* removing close override from decodedresponse

* line removal

---------

Co-authored-by: Isabelle <ibrandes@microsoft.com>

* Storage Content Validation - Defer MD5 + CRC64 Val Conflict to Service (#48999)

* impl and tests

* cleanup

* updating assets

* strengthening sync assertations

* Storage Content Validation - adding failure tests for content validation decoder (#49073)

* adding failure tests for content validation decoder

* adding Decoder Random Byte Failure Case Test

* rearrange code to make it a little more human readable

* fix linting

---------

Co-authored-by: browndav <browndav@microsoft.com>

* Storage Content Validation - Audit DecodedResponse (#49147)

* Audit DecodedResponse: tighten override surface, pin UTF-8, add unit tests

* Reduce DecodedResponse to minimal override surface

Strip overrides and tests that aren't required for transparent HttpResponse behavior, leaving exactly the compiler-required abstract methods plus one discretionary override that fixes a proven base-class bug.

DecodedResponse.java:
- Remove close() override. Current consumers fully drain the body Flux, so Reactor's onComplete signals release the underlying transport; the explicit close-forwarding was defensive against a try-with-resources / status-only pattern that no caller in the codebase actually uses.
- Collapse no-arg getBodyAsString() to delegate to the charset overload, pinning UTF-8 in one place instead of duplicating the lambda.
- Final override surface (8 methods): the 7 abstract methods on HttpResponse in azure-core 1.57.1 (compiler-required) plus getBodyAsBinaryData, which is concrete in the base but seeds BinaryData with the wire Content-Length header, making BinaryData.getLength() return the encoded size (frames + CRC trailers) instead of the decoded payload size.

DecodedResponseTests.java:
- Remove closeDelegatesToWrappedResponse and closeDoesNotSubscribeToDecodedBody (no override left to validate).
- Drop the close-counting assertion from the writeBodyTo test and rename it to inheritedWriteBodyToWritesDecodedBytes; it now uses MockHttpResponse directly.
- Strengthen getBodyAsBinaryDataReportsDecodedSizeNotContentLength: assert data.getLength() equals the decoded size (post-consumption). Without the override this returns 71 instead of 7, empirically reproduced.
- Drop now-unused trackingResponse helper, AtomicInteger import.

Tests: 10 of 10 passing. Each test maps 1:1 to one override or one inherited integration; no test is redundant.

* some code cleanup

* Address Copilot PR #49147 review comments

DecodedResponse.java (comment r3220562536):
- Restore HttpResponse#getBodyAsString() base contract by switching from unconditional UTF-8 to CoreUtils.bomAwareToString(bytes, contentType), matching BufferedHttpResponse's idiom. The previous UTF-8 pin silently dropped BOM detection and Content-Type charset honoring, which callers viewing this as a generic HttpResponse expect.

DecodedResponseTests.java (comment r3220562553):
- Add inheritedGetBodyAsBinaryDataReturnsDecodedBytes: exercises the inherited HttpResponse#getBodyAsBinaryData() and asserts the bytes match the decoded payload. Uses a divergent Content-Length header to make the wire vs decoded distinction explicit and guard against header-forwarding regressions.
- Add getBodyAsStringHonorsCharsetFromContentTypeHeader: proves the bom-aware fix actually honors a charset declared in Content-Type (would fail if the previous UTF-8 pinning were still in place).
- Add getBodyAsStringDetectsUtf8BomAndStripsIt: pins the BOM-detection arm of CoreUtils.bomAwareToString.
- Update getBodyAsStringDefaultsToUtf8WhenNoCharsetSpecified docstring to describe the new bom-aware fallback semantics rather than the old unconditional UTF-8 behavior.

Tests: 12 of 12 passing.

* some code cleanup

* analyze error

---------

Co-authored-by: Isabelle <ibrandes@microsoft.com>

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

* add checks for response headers

* fix linting

* refactor async, change messageDownloadRequestHeaders signatures

* fix methods with wrong method names

* refactor sync

* remove unnecessary helper in BlobTestBase

* reuse hasStructuredMessageDownloadRequestHeaders with List<HttpHeaders>

* remove unused imports

* apply copilot suggestions

* fix linting

* inline local variables

* remove try-finally, replace with @tempdir

* add checks for response headers

* add recording for downloadStreamWithResponseContentValidationRange

* readd recording

* rerecord recordings

* Storage Content Validation - Verify Download Progress Listener Support (#49157)

* tests and blob client changes

* addressing copilot comments

* updating assets

* Storage Content Validation - Fuzzy Upload Tests (#49031)

* tests and assets

* addressing copilot comments

* making things actually fuzzy

* cleanup

* cleanup

* addressing copilot comments

* recordings

* resolving conflicts

* updating assets

* Storage Content Validation - adding fuzzy tests for content validation decoder (#49058)

* adding fuzzy tests for content validation decoder

* adding recordings

* adding few fuzzy tests

* randomizing fuzzy test payloads

* randomizing fuzzy test payloads

* fixing code review comments

* fix spotless formatting violation in BlobContentValidationAsyncDownloadTests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Local Merge <merge@local.tmp>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* Storage - Content Validation Decoder Dynamic Segment Size Tests and Large GET Behavior Notes (#49172)

* tests for dynamic segment size encoding and decoding

* cleanup

* cleanup

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* style

* cant change pr name while ci is running i guess. no-op change

* cleaning up test file

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Storage - Decoder Perf Improvements (#49205)

* refactoring

* removing unused code

* reverting unecessary changes

* reverting unecessary changes

* reverting unecessary changes

* not pre-allocating entire byte array of segment size

* renaming variable

* adding back unecessary removals

* renaming variable

* addressing copilot comments

* Storage - Content validation content-length override (#49226)

* content length override changes

* content length override changes

* removing stuff

* addressing review comments

* addressing review comments

* addressing review comments

* resolving merge conflicts

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fixing spotbugs

* fixing spellchecks

---------

Co-authored-by: Local Merge <merge@local.tmp>
Co-authored-by: Isabelle <141270045+ibrandes@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Storage - Content Validation Decoder Stress Tests (#49255)

* adding stress tests for content validation decoder

* fix TelemetryHelper, add tru to registerOberservers()

* Storage - Fix Flaky Stress Tests (#48359)

* removed enableDeterministic

* change .delete() to .deleteIfExists()

* remove Sinks.EmitFailureHandler.FAIL_FAST from CrcInputStream

- read functions had FAIL_FAST which would throw an error when  the stream had reached then end and we wanted to read from the stream again. So we removed from  both reads.
- refactor code so that the exit criteria is a tthe beginning
- refactor the emitContentInfo for dry

* prevent crashes on reattempted close on stream

- changed emitValue to tryEmitValue
- remove Sinks.EmitFailureHandler.FAIL_FAST so that multiple closes does not cause an error to be thrown

* fix telemetry so that it doesnt swallow errors

* roll back two deps because they were causing failures in the containers

- opentelemetry-runtime-telemetry-java8 from 2.24.0-alpha -> 2.15.0-alpha
- opentelemetry-logback-appender-1.0 from 2.24.0-alpha -> 2.15.0-alpha

* rollback azure-client-sdk-parent linting extensions from 1.0.0-beta.2 t0 beta.1

* revert linting extensions to beta2

* remove comments with old code

* add logging for errors

* remove catches for double close issue and okay status

* recursively delete files then delete the directory

* change to sync deletes, refactor for easier reading

* restructing share clean up so super calls only once

* incorporate copilot suggestions

* incorporate copilot suggestions

* incorporate copilot suggestions

* incorporate copilot suggestions

* fix all deletes to make sync and wrap in try-catch

* fix tests so that super.globalCleanupAsync() is only called once

* change telemetry to loggin only returns final state instead of failed retries when ultimately successful

* undo versio downgrade for linting-extensions

* Fixing spacing in error messages

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* refactor datalake delete all so that it is easier to read

* refactor runAsync in ShareScenarioBase so retry failures dont show as failures upon success

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* changes to cvdownload content, lazyload versus eagerloading

* update to TelemetryHelper based on previous cherry picked stress tests fixes

* Fix storage stress fault injector certificate trust

Export the fault injector certificate as PEM and wait for it before importing it into the Java truststore so storage stress tests fail fast instead of hitting PKIX errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* bump opentelemetry version

* add cv tests to App.class

* add script to delete resource groups

* update scenarios matrix with tests for cv

* fixing stress tests

* stageblocksmall scenario adjustment

* wip

* avoid depending on raw short baseName being available globally

* dep pinning

* reversion

* adding back

* wip

* storageseekablebytechannel change

* bare minimum changes

* removing perf core change

* removing redundant test file and non-blob package changes

* removing redundant test file and non-blob package changes

* renaming files and hardcoding crc64 option

* removing unused test

* removing unused imports

---------

Co-authored-by: browndav <browndav@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Local Merge <merge@local.tmp>
Co-authored-by: Isabelle <ibrandes@microsoft.com>

* Storage - Content Validation Encoder Stress Tests (#48979)

* Add encoder stress tests

* enabling fault injector

* restoring commitblocklist

* renaming files and hardcoding crc64 option

* adding scenarios back to app.java

---------

Co-authored-by: Rabab Ibrahim <ibrahimr@microsoft.com>
Co-authored-by: Isabelle <141270045+ibrandes@users.noreply.github.com>
Co-authored-by: Isabelle <ibrandes@microsoft.com>
Co-authored-by: browndav <browndav@microsoft.com>
Co-authored-by: Local Merge <merge@local.tmp>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants