Test that SLO disallows too small first segment if other segments
SLO allows the first segment to be less than min_segment_size if it is the only segment. Current tests verify that a single small segment is allowed, and that multiple small segments are disallowed. This patch adds a test to verify that SLO will disallow a manifest with a small first segment followed by another correctly sized segment. Change-Id: I920c0aee38e4e16c49bd84a3b772308a00794fa7
This commit is contained in:
parent
60504a9d23
commit
7958729198
@ -268,6 +268,21 @@ class TestSloPutManifest(SloTestCase):
|
||||
self.slo(req.environ, fake_start_response)
|
||||
self.assertTrue('X-Static-Large-Object' in req.headers)
|
||||
|
||||
def test_handle_multipart_put_disallow_small_first_segment(self):
|
||||
with patch.object(self.slo, 'min_segment_size', 50):
|
||||
test_json_data = json.dumps([{'path': '/cont/object',
|
||||
'etag': 'etagoftheobjectsegment',
|
||||
'size_bytes': 10},
|
||||
{'path': '/cont/small_object',
|
||||
'etag': 'etagoftheobjectsegment',
|
||||
'size_bytes': 100}])
|
||||
req = Request.blank('/v1/a/c/o', body=test_json_data)
|
||||
try:
|
||||
self.slo.handle_multipart_put(req, fake_start_response)
|
||||
except HTTPException as e:
|
||||
pass
|
||||
self.assertEquals(e.status_int, 400)
|
||||
|
||||
def test_handle_multipart_put_success_unicode(self):
|
||||
test_json_data = json.dumps([{'path': u'/cont/object\u2661',
|
||||
'etag': 'etagoftheobjectsegment',
|
||||
|
Loading…
x
Reference in New Issue
Block a user