Skip to content

s3: test checksumming with streaming uploads#540

Open
cbodley wants to merge 1 commit intoceph:masterfrom
cbodley:wip-streaming-checksum
Open

s3: test checksumming with streaming uploads#540
cbodley wants to merge 1 commit intoceph:masterfrom
cbodley:wip-streaming-checksum

Conversation

@cbodley
Copy link
Copy Markdown
Contributor

@cbodley cbodley commented Jan 31, 2024

client.put_object() doesn't seem to support STREAMING payloads, but client.upload_fileobj() can

against http endpoint:

2024-01-31T11:06:33.649-0500 7f038d3bb6c0 20 HTTP_X_AMZ_CHECKSUM_CRC32=Ms4xMg==
2024-01-31T11:06:33.649-0500 7f038d3bb6c0 20 HTTP_X_AMZ_CONTENT_SHA256=cdbec94cbcdbdfc1e8202c189dcec8d72d21157a02bba3a03f0b702ed5b3fe56
2024-01-31T11:06:33.649-0500 7f038d3bb6c0 20 HTTP_X_AMZ_DATE=20240131T160633Z
2024-01-31T11:06:33.649-0500 7f038d3bb6c0 20 HTTP_X_AMZ_SDK_CHECKSUM_ALGORITHM=CRC32

against https endpoint:

2024-01-31T11:10:04.721-0500 7fb0fa7ac6c0 20 HTTP_X_AMZ_CONTENT_SHA256=STREAMING-UNSIGNED-PAYLOAD-TRAILER
2024-01-31T11:10:04.721-0500 7fb0fa7ac6c0 20 HTTP_X_AMZ_DATE=20240131T161004Z
2024-01-31T11:10:04.721-0500 7fb0fa7ac6c0 20 HTTP_X_AMZ_DECODED_CONTENT_LENGTH=7340032
2024-01-31T11:10:04.721-0500 7fb0fa7ac6c0 20 HTTP_X_AMZ_SDK_CHECKSUM_ALGORITHM=CRC32
2024-01-31T11:10:04.721-0500 7fb0fa7ac6c0 20 HTTP_X_AMZ_TRAILER=x-amz-checksum-crc32

@cbodley cbodley requested a review from mattbenjamin January 31, 2024 16:11
@cbodley cbodley force-pushed the wip-streaming-checksum branch from 86e15d3 to c619a9a Compare February 13, 2024 22:19
Comment on lines +13104 to +13929
# test streaming uploads with sizes below and above the 8MB multipart threshold
upload_sizes = [7 * 1024 * 1024, 9 * 1024 * 1024]

@pytest.mark.checksum
@pytest.mark.parametrize("size", upload_sizes)
def test_streaming_upload_checksum_crc32(size):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the original 7MB size was below the default multipart threshold of 8MB, so wasn't testing multipart uploads. i parameterized these tests for sizes 7MB and 9MB to cover both

@cbodley cbodley force-pushed the wip-streaming-checksum branch 3 times, most recently from 8c071c5 to 47f532c Compare February 14, 2024 00:49
@cbodley
Copy link
Copy Markdown
Contributor Author

cbodley commented Feb 14, 2024

these test cases are all passing against aws us-east-1

@cbodley
Copy link
Copy Markdown
Contributor Author

cbodley commented Aug 7, 2024

part of this merged in #564, but the streaming upload tests weren't included

@cbodley cbodley force-pushed the wip-streaming-checksum branch 2 times, most recently from 310a500 to 398efc5 Compare October 9, 2024 14:09
Signed-off-by: Casey Bodley <cbodley@redhat.com>
@cbodley
Copy link
Copy Markdown
Contributor Author

cbodley commented Oct 9, 2024

updated to parameterize the checksum algorithm too:

~/s3-tests $ S3TEST_CONF=s3tests.conf.SAMPLE tox -- s3tests_boto3/functional/test_s3.py -m checksum -v -x
...
s3tests_boto3/functional/test_s3.py::test_object_checksum_sha256 PASSED                      [  8%]
s3tests_boto3/functional/test_s3.py::test_multipart_checksum_sha256 PASSED                   [ 16%] 
s3tests_boto3/functional/test_s3.py::test_multipart_checksum_3parts PASSED                   [ 25%]
s3tests_boto3/functional/test_s3.py::test_post_object_upload_checksum PASSED                 [ 33%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[CRC32-7340032] PASSED    [ 41%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[CRC32-9437184] PASSED    [ 50%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[CRC32C-7340032] PASSED   [ 58%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[CRC32C-9437184] PASSED   [ 66%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[SHA1-7340032] PASSED     [ 75%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[SHA1-9437184] PASSED     [ 83%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[SHA256-7340032] PASSED   [ 91%]
s3tests_boto3/functional/test_s3.py::test_streaming_upload_checksum[SHA256-9437184] PASSED   [100%]

@cbodley cbodley force-pushed the wip-streaming-checksum branch from 398efc5 to c1c5d79 Compare October 10, 2024 12:56
@mattbenjamin
Copy link
Copy Markdown
Contributor

in my testing with I guess the earlier version, including awscrt seemed to cause other tests to fail; are you not seeing that?

@cbodley
Copy link
Copy Markdown
Contributor Author

cbodley commented Oct 10, 2024

in my testing with I guess the earlier version, including awscrt seemed to cause other tests to fail; are you not seeing that?

doh, thanks. i've only tried the checksum tests

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants