Merge pull request #195 from ceph/wip-fix-416

Check for either 400 or 416 response code for invalid range test
This commit is contained in:
vasukulkarni 2017-11-07 14:22:45 -08:00 committed by GitHub
commit 33b1589969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5351,9 +5351,14 @@ def test_multipart_copy_invalid_range():
bucket, key = _create_key_with_random_content('source', size=5) bucket, key = _create_key_with_random_content('source', size=5)
upload = bucket.initiate_multipart_upload('dest') upload = bucket.initiate_multipart_upload('dest')
e = assert_raises(boto.exception.S3ResponseError, copy_part, bucket.name, key.name, bucket, 'dest', upload.id, 0, 0, 21) e = assert_raises(boto.exception.S3ResponseError, copy_part, bucket.name, key.name, bucket, 'dest', upload.id, 0, 0, 21)
eq(e.status, 400) valid_status = [400, 416]
eq(e.reason, 'Bad Request') if not e.status in valid_status:
eq(e.error_code, 'InvalidArgument') raise AssertionError("Invalid response " + str(status))
valid_reason = ['Bad Request', 'Requested Range Not Satisfiable']
if not e.reason in valid_reason:
raise AssertionError("Invalid reason " + e.reason )
# no standard error code defined
# eq(e.error_code, 'InvalidArgument')
@attr(resource='object') @attr(resource='object')
@attr(method='put') @attr(method='put')