mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-21 23:29:47 +00:00
boto3/test_s3: range encoding helper function takes a size argument
This is to avoid a get_object call for every range check as the object size will
not change during this duration and we'd most likely already know the object
sizes beforehand
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 741f2cbc9e
)
This commit is contained in:
parent
dc7068b75b
commit
7682983704
1 changed files with 3 additions and 5 deletions
|
@ -9302,9 +9302,7 @@ def _multipart_upload_enc(client, bucket_name, key, size, part_size, init_header
|
|||
|
||||
return (upload_id, s, parts)
|
||||
|
||||
def _check_content_using_range_enc(client, bucket_name, key, data, step, enc_headers=None):
|
||||
response = client.get_object(Bucket=bucket_name, Key=key)
|
||||
size = response['ContentLength']
|
||||
def _check_content_using_range_enc(client, bucket_name, key, data, size, step, enc_headers=None):
|
||||
for ofs in range(0, size, step):
|
||||
toread = size - ofs
|
||||
if toread > step:
|
||||
|
@ -9362,8 +9360,8 @@ def test_encryption_sse_c_multipart_upload():
|
|||
size = response['ContentLength']
|
||||
assert len(body) == size
|
||||
|
||||
_check_content_using_range_enc(client, bucket_name, key, data, 1000000, enc_headers=enc_headers)
|
||||
_check_content_using_range_enc(client, bucket_name, key, data, 10000000, enc_headers=enc_headers)
|
||||
_check_content_using_range_enc(client, bucket_name, key, data, size, 1000000, enc_headers=enc_headers)
|
||||
_check_content_using_range_enc(client, bucket_name, key, data, size, 10000000, enc_headers=enc_headers)
|
||||
|
||||
@pytest.mark.encryption
|
||||
def test_encryption_sse_c_unaligned_multipart_upload():
|
||||
|
|
Loading…
Reference in a new issue