Skip to content

Fix checksum tests#6895

Merged
davidh44 merged 4 commits intomasterfrom
zoewang/fixChecksumTests
Apr 25, 2026
Merged

Fix checksum tests#6895
davidh44 merged 4 commits intomasterfrom
zoewang/fixChecksumTests

Conversation

@zoewangg
Copy link
Copy Markdown
Contributor

@zoewangg zoewangg commented Apr 23, 2026

Motivation and Context

The parameterized checksum tests in MultipartClientChecksumTest has hardcoded switch statement: multipartUpload_withChecksumValueProvided_shouldUseSameAlgorithmForUploadAndAddChecksumTypeFullObject used a switch over ChecksumAlgorithm to call the corresponding setter (e.g., checksumCRC32(), checksumSHA256()). Every time a new checksum algorithm is added to the S3 model, this test would fail to compile until manually updated.

Modifications

  • Replaced the hardcoded switch statement with dynamic SdkField-based value setting. The test now finds the matching field via "Checksum" + algorithm on PutObjectRequest.Builder.sdkFields() and calls field.set(), following the same pattern used in SdkPojoConversionUtils.
  • Re-enabled the two parameterized test methods that were previously commented out.
  • Added multipartUpload_withMd5ChecksumValueProvided_shouldPassThrough — verifies that a pre-computed MD5 checksum value is forwarded through CreateMPU, UploadPart, and CompleteMPU requests with FULL_OBJECT checksum type.
  • Added multipartUpload_withMd5ChecksumAlgorithmProvided_shouldThrowException — verifies that setting checksumAlgorithm(MD5) (asking the SDK to compute MD5) throws an exception with "MD5 is not supported".

Testing

  • Added unit tests
  • Ran existing tests

All MultipartClientChecksumTest tests pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn clean install -pl :s3 succeeds for affected modules
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@zoewangg zoewangg requested a review from a team as a code owner April 23, 2026 03:38
@sonarqubecloud
Copy link
Copy Markdown

@zoewangg zoewangg added this pull request to the merge queue Apr 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Apr 23, 2026
@zoewangg zoewangg enabled auto-merge April 23, 2026 20:35
@zoewangg zoewangg added this pull request to the merge queue Apr 24, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Apr 24, 2026
@zoewangg zoewangg added this pull request to the merge queue Apr 24, 2026
@alextwoods alextwoods removed this pull request from the merge queue due to a manual request Apr 24, 2026
@zoewangg zoewangg enabled auto-merge April 24, 2026 17:39
@davidh44 davidh44 disabled auto-merge April 24, 2026 21:47
@davidh44 davidh44 added this pull request to the merge queue Apr 24, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 24, 2026
@davidh44 davidh44 enabled auto-merge April 25, 2026 02:32
@davidh44 davidh44 added this pull request to the merge queue Apr 25, 2026
Merged via the queue into master with commit 0697b80 Apr 25, 2026
11 of 12 checks passed
@github-actions
Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants