s3api: make MPU part error response message same as S3

Change-Id: I60f0b36633c2a348933fd45d348d76b256fca57a
This commit is contained in:
Alistair Coles
2025-04-16 12:16:00 +01:00
parent c7f93f0f63
commit ab5c742e2b
3 changed files with 13 additions and 8 deletions

View File

@@ -472,9 +472,9 @@ class InvalidPartArgument(InvalidArgument):
class InvalidPart(ErrorResponse):
_status = '400 Bad Request'
_msg = 'One or more of the specified parts could not be found. The part ' \
'might not have been uploaded, or the specified entity tag might ' \
'not have matched the part\'s entity tag.'
_msg = 'One or more of the specified parts could not be found. The ' \
'part may not have been uploaded, or the specified entity tag ' \
'may not match the part\'s entity tag.'
class InvalidPartOrder(ErrorResponse):

View File

@@ -848,9 +848,11 @@ class TestMultiPartUpload(BaseMultiPartUploadTestCase):
'ResponseMetadata']['HTTPStatusCode'])
self.assertEqual('InvalidPart', complete_mpu_resp[
'Error']['Code'])
self.assertTrue(complete_mpu_resp['Error']['Message'].startswith(
'One or more of the specified parts could not be found.'
), complete_mpu_resp['Error']['Message'])
self.assertEqual(
"One or more of the specified parts could not be found. The part "
"may not have been uploaded, or the specified entity tag may not "
"match the part's entity tag.",
complete_mpu_resp['Error']['Message'])
self.assertEqual(complete_mpu_resp['Error']['UploadId'], upload_id)
self.assertIn(complete_mpu_resp['Error']['PartNumber'], ('1', '2'))
self.assertEqual(complete_mpu_resp['Error']['ETag'], None)

View File

@@ -1888,8 +1888,11 @@ class TestS3ApiMultiUpload(BaseS3ApiMultiUpload, S3ApiTestCase):
fromstring(body, 'Error')
self.assertEqual(status.split()[0], '200')
self.assertEqual(self._get_error_code(body), 'InvalidPart')
self.assertIn('One or more of the specified parts could not be found',
self._get_error_message(body))
self.assertEqual(
"One or more of the specified parts could not be found. The part "
"may not have been uploaded, or the specified entity tag may not "
"match the part's entity tag.",
self._get_error_message(body))
self.assertEqual(self.swift.calls, [
('HEAD', '/v1/AUTH_test'),
('HEAD', '/v1/AUTH_test/bucket'),