mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-22 09:29:43 +00:00
Test half-open range requests
This commit is contained in:
parent
a23c81187b
commit
b81a718794
1 changed files with 44 additions and 0 deletions
|
@ -4747,6 +4747,50 @@ def test_ranged_request_response_code():
|
||||||
eq(fetched_content, content[4:8])
|
eq(fetched_content, content[4:8])
|
||||||
eq(status, 206)
|
eq(status, 206)
|
||||||
|
|
||||||
|
@attr(resource='object')
|
||||||
|
@attr(method='get')
|
||||||
|
@attr(operation='range')
|
||||||
|
@attr(assertion='returns correct data, 206')
|
||||||
|
def test_ranged_request_skip_leading_bytes_response_code():
|
||||||
|
content = 'testcontent'
|
||||||
|
|
||||||
|
bucket = get_new_bucket()
|
||||||
|
key = bucket.new_key('testobj')
|
||||||
|
key.set_contents_from_string(content)
|
||||||
|
|
||||||
|
# test trailing bytes
|
||||||
|
key.open('r', headers={'Range': 'bytes=4-'})
|
||||||
|
status = key.resp.status
|
||||||
|
fetched_content = ''
|
||||||
|
for data in key:
|
||||||
|
fetched_content += data;
|
||||||
|
key.close()
|
||||||
|
|
||||||
|
eq(fetched_content, content[4:])
|
||||||
|
eq(status, 206)
|
||||||
|
|
||||||
|
@attr(resource='object')
|
||||||
|
@attr(method='get')
|
||||||
|
@attr(operation='range')
|
||||||
|
@attr(assertion='returns correct data, 206')
|
||||||
|
def test_ranged_request_return_trailing_bytes_response_code():
|
||||||
|
content = 'testcontent'
|
||||||
|
|
||||||
|
bucket = get_new_bucket()
|
||||||
|
key = bucket.new_key('testobj')
|
||||||
|
key.set_contents_from_string(content)
|
||||||
|
|
||||||
|
# test leading bytes
|
||||||
|
key.open('r', headers={'Range': 'bytes=-7'})
|
||||||
|
status = key.resp.status
|
||||||
|
fetched_content = ''
|
||||||
|
for data in key:
|
||||||
|
fetched_content += data;
|
||||||
|
key.close()
|
||||||
|
|
||||||
|
eq(fetched_content, content[-7:])
|
||||||
|
eq(status, 206)
|
||||||
|
|
||||||
def check_can_test_multiregion():
|
def check_can_test_multiregion():
|
||||||
if not targets.main.master or len(targets.main.secondaries) == 0:
|
if not targets.main.master or len(targets.main.secondaries) == 0:
|
||||||
raise SkipTest
|
raise SkipTest
|
||||||
|
|
Loading…
Reference in a new issue