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