Bump minimum Swift requirement to Ocata stable
And this also removes redundant code to support Swift < 2.6.0. Change-Id: I978f9dcc1433f66e62cab76a05525714eba75c64
This commit is contained in:
parent
fc66da81a5
commit
31d4353bf1
@ -1,4 +1,4 @@
|
||||
swift>=2.1.0
|
||||
swift>=2.13.0
|
||||
lxml
|
||||
requests!=2.9.0,>=2.8.1 # Apache-2.0
|
||||
six>=1.9.0
|
||||
|
@ -566,11 +566,9 @@ class UploadController(Controller):
|
||||
if manifest[-1]['size_bytes'] == 0:
|
||||
empty_seg = manifest.pop()
|
||||
|
||||
# Ordinarily, we just let SLO check segment sizes. However, we
|
||||
# just popped off a zero-byte segment; if there was a second
|
||||
# zero-byte segment and it was at the end, it would succeed on
|
||||
# Swift < 2.6.0 and fail on newer Swift. It seems reasonable that
|
||||
# it should always fail.
|
||||
# We'll check the sizes of all except the last segment below, but
|
||||
# since we just popped off a zero-byte segment, we should check
|
||||
# that last segment, too.
|
||||
if manifest and manifest[-1]['size_bytes'] < CONF.min_segment_size:
|
||||
raise EntityTooSmall()
|
||||
|
||||
@ -594,14 +592,8 @@ class UploadController(Controller):
|
||||
headers=headers)
|
||||
except BadSwiftRequest as e:
|
||||
msg = str(e)
|
||||
msg_pre_260 = 'Each segment, except the last, must be at least '
|
||||
# see https://github.com/openstack/swift/commit/c0866ce
|
||||
msg_260 = ('too small; each segment, except the last, must be '
|
||||
'at least ')
|
||||
# see https://github.com/openstack/swift/commit/7f636a5
|
||||
msg_post_260 = 'too small; each segment must be at least 1 byte'
|
||||
if msg.startswith(msg_pre_260) or \
|
||||
msg_260 in msg or msg_post_260 in msg:
|
||||
expected_msg = 'too small; each segment must be at least 1 byte'
|
||||
if expected_msg in msg:
|
||||
# FIXME: AWS S3 allows a smaller object than 5 MB if there is
|
||||
# only one part. Use a COPY request to copy the part object
|
||||
# from the segments container instead.
|
||||
|
@ -652,30 +652,21 @@ class TestSwift3MultiUpload(Swift3TestCase):
|
||||
self.assertEqual(headers.get('X-Object-Meta-Foo'), 'bar')
|
||||
|
||||
def test_object_multipart_upload_complete_segment_too_small(self):
|
||||
msgs = [
|
||||
# pre-2.6.0 swift
|
||||
'Each segment, except the last, must be at least 1234 bytes.',
|
||||
# swift 2.6.0
|
||||
'Index 0: too small; each segment, except the last, must be '
|
||||
'at least 1234 bytes.',
|
||||
# swift 2.7.0+
|
||||
'Index 0: too small; each segment must be at least 1 byte.',
|
||||
]
|
||||
msg = 'Index 0: too small; each segment must be at least 1 byte.'
|
||||
|
||||
for msg in msgs:
|
||||
req = Request.blank(
|
||||
'/bucket/object?uploadId=X',
|
||||
environ={'REQUEST_METHOD': 'POST'},
|
||||
headers={'Authorization': 'AWS test:tester:hmac',
|
||||
'Date': self.get_date_header(), },
|
||||
body=xml)
|
||||
req = Request.blank(
|
||||
'/bucket/object?uploadId=X',
|
||||
environ={'REQUEST_METHOD': 'POST'},
|
||||
headers={'Authorization': 'AWS test:tester:hmac',
|
||||
'Date': self.get_date_header(), },
|
||||
body=xml)
|
||||
|
||||
self.swift.register('PUT', '/v1/AUTH_test/bucket/object',
|
||||
swob.HTTPBadRequest, {}, msg)
|
||||
status, headers, body = self.call_swift3(req)
|
||||
self.assertEqual(status.split()[0], '400')
|
||||
self.assertEqual(self._get_error_code(body), 'EntityTooSmall')
|
||||
self.assertEqual(self._get_error_message(body), msg)
|
||||
self.swift.register('PUT', '/v1/AUTH_test/bucket/object',
|
||||
swob.HTTPBadRequest, {}, msg)
|
||||
status, headers, body = self.call_swift3(req)
|
||||
self.assertEqual(status.split()[0], '400')
|
||||
self.assertEqual(self._get_error_code(body), 'EntityTooSmall')
|
||||
self.assertEqual(self._get_error_message(body), msg)
|
||||
|
||||
self.swift.clear_calls()
|
||||
CONF.min_segment_size = 5242880
|
||||
|
4
tox.ini
4
tox.ini
@ -7,10 +7,10 @@ skipsdist = True
|
||||
whitelist_externals =/bin/bash
|
||||
usedevelop = True
|
||||
install_command = pip install {opts} {packages}
|
||||
# swift 2.7.0 from github
|
||||
# swift stable/ocata (about 2.13.0) from openstack.org
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
http://tarballs.openstack.org/swift/swift-2.7.0.tar.gz
|
||||
http://tarballs.openstack.org/swift/swift-stable-ocata.tar.gz
|
||||
commands = nosetests {posargs:swift3/test/unit}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
NOSE_WITH_OPENSTACK=1
|
||||
|
Loading…
x
Reference in New Issue
Block a user