s3api test for zero byte mpu

Change-Id: I89050cead3ef2d5f8ebfc9cb58f736f33b1c44fe
This commit is contained in:
Clay Gerrard 2024-02-27 15:46:07 -06:00
parent 46e7da97c6
commit d10351db30

View File

@ -215,6 +215,40 @@ class TestMultiPartUpload(BaseMultiPartUploadTestCase):
self.assertEqual(200, complete_mpu_resp[
'ResponseMetadata']['HTTPStatusCode'])
def test_zero_byte_segment_upload(self):
key_name = self.create_name('key')
create_mpu_resp = self.client.create_multipart_upload(
Bucket=self.bucket_name, Key=key_name)
self.assertEqual(200, create_mpu_resp[
'ResponseMetadata']['HTTPStatusCode'])
upload_id = create_mpu_resp['UploadId']
part_resp = self.client.upload_part(
Body='', Bucket=self.bucket_name, Key=key_name,
PartNumber=1, UploadId=upload_id)
self.assertEqual(200, part_resp[
'ResponseMetadata']['HTTPStatusCode'])
parts = [{
'ETag': part_resp['ETag'],
'PartNumber': 1,
}]
list_parts_resp = self.client.list_parts(
Bucket=self.bucket_name, Key=key_name,
UploadId=upload_id,
)
self.assertEqual(200, list_parts_resp[
'ResponseMetadata']['HTTPStatusCode'])
self.assertEqual(parts, [{k: p[k] for k in ('ETag', 'PartNumber')}
for p in list_parts_resp['Parts']])
complete_mpu_resp = self.client.complete_multipart_upload(
Bucket=self.bucket_name, Key=key_name,
MultipartUpload={
'Parts': parts,
},
UploadId=upload_id,
)
self.assertEqual(200, complete_mpu_resp[
'ResponseMetadata']['HTTPStatusCode'])
def _check_part_num_invalid_exc(self, exc, val, max_part_num,
is_head=False):
err_resp = exc.response