Skip to content

Commit 27ae8f8

Browse files
committed
Merge pull request #4 from basho/riakcs-2.1-honest-but-long-way-around
Update to upstream HEAD and changes for Riak CS 2.1 release
2 parents 2cf6908 + 6bc012a commit 27ae8f8

File tree

3 files changed

+59
-8
lines changed

3 files changed

+59
-8
lines changed

s3tests/common.py

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def connect(conf):
8888
mapping = dict(
8989
port='port',
9090
host='host',
91+
proxy='proxy',
92+
proxy_port='proxy_port',
9193
is_secure='is_secure',
9294
access_key='aws_access_key_id',
9395
secret_key='aws_secret_access_key',

s3tests/functional/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,16 @@ def setup():
295295
regions.add(name, TargetConfig(cfg, section))
296296

297297
for section in cfg.sections():
298+
try:
299+
proxy = cfg.get(section, 'proxy')
300+
except ConfigParser.NoOptionError:
301+
proxy = None
302+
303+
try:
304+
proxy_port = cfg.getint(section, 'proxy_port')
305+
except ConfigParser.NoOptionError:
306+
proxy_port = None
307+
298308
try:
299309
(type_, name) = section.split(None, 1)
300310
except ValueError:
@@ -323,6 +333,8 @@ def setup():
323333
aws_access_key_id=cfg.get(section, 'access_key'),
324334
aws_secret_access_key=cfg.get(section, 'secret_key'),
325335
is_secure=conf.is_secure,
336+
proxy=proxy,
337+
proxy_port=proxy_port,
326338
port=conf.port,
327339
host=conf.host,
328340
# TODO test vhost calling format

s3tests/functional/test_s3.py

+45-8
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def validate_bucket_list(bucket, prefix, delimiter, marker, max_keys,
213213
@attr(method='get')
214214
@attr(operation='list')
215215
@attr(assertion='prefixes in multi-component object names')
216+
@attr('fails_on_rcs')
216217
def test_bucket_list_delimiter_prefix():
217218
bucket = _create_keys(keys=['asdf', 'boo/bar', 'boo/baz/xyzzy', 'cquux/thud', 'cquux/bla'])
218219

@@ -994,6 +995,7 @@ def test_object_set_get_unicode_metadata():
994995
@attr(operation='metadata write/re-write')
995996
@attr(assertion='non-UTF-8 values detected, but preserved')
996997
@attr('fails_strict_rfc2616')
998+
@attr('fails_on_rcs')
997999
def test_object_set_get_non_utf8_metadata():
9981000
bucket = get_new_bucket()
9991001
key = boto.s3.key.Key(bucket)
@@ -1022,6 +1024,7 @@ def _set_get_metadata_unreadable(metadata, bucket=None):
10221024
@attr(operation='metadata write')
10231025
@attr(assertion='non-priting prefixes noted and preserved')
10241026
@attr('fails_strict_rfc2616')
1027+
@attr('fails_on_rcs')
10251028
def test_object_set_get_metadata_empty_to_unreadable_prefix():
10261029
metadata = '\x04w'
10271030
got = _set_get_metadata_unreadable(metadata)
@@ -1033,6 +1036,7 @@ def test_object_set_get_metadata_empty_to_unreadable_prefix():
10331036
@attr(operation='metadata write')
10341037
@attr(assertion='non-priting suffixes noted and preserved')
10351038
@attr('fails_strict_rfc2616')
1039+
@attr('fails_on_rcs')
10361040
def test_object_set_get_metadata_empty_to_unreadable_suffix():
10371041
metadata = 'h\x04'
10381042
got = _set_get_metadata_unreadable(metadata)
@@ -1043,6 +1047,7 @@ def test_object_set_get_metadata_empty_to_unreadable_suffix():
10431047
@attr(method='put')
10441048
@attr(operation='metadata write')
10451049
@attr(assertion='non-priting in-fixes noted and preserved')
1050+
@attr('fails_on_rcs')
10461051
def test_object_set_get_metadata_empty_to_unreadable_infix():
10471052
metadata = 'h\x04w'
10481053
got = _set_get_metadata_unreadable(metadata)
@@ -1054,6 +1059,7 @@ def test_object_set_get_metadata_empty_to_unreadable_infix():
10541059
@attr(operation='metadata re-write')
10551060
@attr(assertion='non-priting prefixes noted and preserved')
10561061
@attr('fails_strict_rfc2616')
1062+
@attr('fails_on_rcs')
10571063
def test_object_set_get_metadata_overwrite_to_unreadable_prefix():
10581064
metadata = '\x04w'
10591065
got = _set_get_metadata_unreadable(metadata)
@@ -1068,6 +1074,7 @@ def test_object_set_get_metadata_overwrite_to_unreadable_prefix():
10681074
@attr(operation='metadata re-write')
10691075
@attr(assertion='non-priting suffixes noted and preserved')
10701076
@attr('fails_strict_rfc2616')
1077+
@attr('fails_on_rcs')
10711078
def test_object_set_get_metadata_overwrite_to_unreadable_suffix():
10721079
metadata = 'h\x04'
10731080
got = _set_get_metadata_unreadable(metadata)
@@ -1081,6 +1088,7 @@ def test_object_set_get_metadata_overwrite_to_unreadable_suffix():
10811088
@attr(method='put')
10821089
@attr(operation='metadata re-write')
10831090
@attr(assertion='non-priting in-fixes noted and preserved')
1091+
@attr('fails_on_rcs')
10841092
def test_object_set_get_metadata_overwrite_to_unreadable_infix():
10851093
metadata = 'h\x04w'
10861094
got = _set_get_metadata_unreadable(metadata)
@@ -2131,7 +2139,7 @@ def test_put_object_ifmatch_good():
21312139
got_data = key.get_contents_as_string()
21322140
eq(got_data, 'bar')
21332141

2134-
key.set_contents_from_string('zar', headers={'If-Match': key.etag.replace('"', '').strip()})
2142+
key.set_contents_from_string('zar', headers={'If-Match': key.etag.strip()})
21352143
got_new_data = key.get_contents_as_string()
21362144
eq(got_new_data, 'zar')
21372145

@@ -2223,7 +2231,7 @@ def test_put_object_ifnonmatch_failed():
22232231
eq(got_data, 'bar')
22242232

22252233
e = assert_raises(boto.exception.S3ResponseError, key.set_contents_from_string, 'zar',
2226-
headers={'If-None-Match': key.etag.replace('"', '').strip()})
2234+
headers={'If-None-Match': key.etag.strip()})
22272235
eq(e.status, 412)
22282236
eq(e.reason, 'Precondition Failed')
22292237
eq(e.error_code, 'PreconditionFailed')
@@ -2310,7 +2318,10 @@ def _make_request(method, bucket, key, body=None, authenticated=False, response_
23102318
else:
23112319
class_ = HTTPConnection
23122320

2313-
c = class_(s3.main.host, s3.main.port, strict=True)
2321+
if s3.main.proxy is None:
2322+
c = class_(s3.main.host, s3.main.port, strict=True)
2323+
else:
2324+
c = class_(s3.main.proxy, s3.main.proxy_port, strict=True)
23142325
c.request(method, path, body=body)
23152326
res = c.getresponse()
23162327

@@ -2335,7 +2346,10 @@ def _make_bucket_request(method, bucket, body=None, authenticated=False, expires
23352346
else:
23362347
class_ = HTTPConnection
23372348

2338-
c = class_(s3.main.host, s3.main.port, strict=True)
2349+
if s3.main.proxy is None:
2350+
c = class_(s3.main.host, s3.main.port, strict=True)
2351+
else:
2352+
c = class_(s3.main.proxy, s3.main.proxy_port, strict=True)
23392353
c.request(method, path, body=body)
23402354
res = c.getresponse()
23412355

@@ -2487,6 +2501,7 @@ def test_object_raw_authenticated():
24872501
@attr(operation='authenticated on private bucket/private object with modified response headers')
24882502
@attr(assertion='succeeds')
24892503
@attr('fails_on_rgw')
2504+
@attr('fails_on_rcs')
24902505
def test_object_raw_response_headers():
24912506
(bucket, key) = _setup_request('private', 'private')
24922507

@@ -2819,6 +2834,7 @@ def test_bucket_create_naming_bad_punctuation():
28192834
@attr(method='put')
28202835
@attr(operation='create w/underscore in name')
28212836
@attr(assertion='succeeds')
2837+
@attr('fails_on_rcs')
28222838
def test_bucket_create_naming_dns_underscore():
28232839
check_good_bucket_name('foo_bar')
28242840

@@ -3377,6 +3393,7 @@ def test_object_acl_canned_bucketownerfullcontrol():
33773393
@attr(method='put')
33783394
@attr(operation='set write-acp')
33793395
@attr(assertion='does not modify owner')
3396+
@attr('fails_on_rcs')
33803397
def test_object_acl_full_control_verify_owner():
33813398
bucket = get_new_bucket(targets.main.default)
33823399
bucket.set_acl('public-read-write')
@@ -3810,6 +3827,7 @@ def _get_acl_header(user=None, perms=None):
38103827
@attr(operation='add all grants to user through headers')
38113828
@attr(assertion='adds all grants individually to second user')
38123829
@attr('fails_on_dho')
3830+
@attr('fails_on_rcs')
38133831
def test_object_header_acl_grants():
38143832
bucket = get_new_bucket()
38153833
headers = _get_acl_header()
@@ -3869,6 +3887,7 @@ def test_object_header_acl_grants():
38693887
@attr(operation='add all grants to user through headers')
38703888
@attr(assertion='adds all grants individually to second user')
38713889
@attr('fails_on_dho')
3890+
@attr('fails_on_rcs')
38723891
def test_bucket_header_acl_grants():
38733892
headers = _get_acl_header()
38743893
bucket = get_new_bucket(targets.main.default, get_prefix(), headers)
@@ -4235,6 +4254,8 @@ def _create_connection_bad_auth(aws_access_key_id='badauth'):
42354254
is_secure=main.is_secure,
42364255
port=main.port,
42374256
host=main.host,
4257+
proxy=main.proxy,
4258+
proxy_port=main.proxy_port,
42384259
calling_format=main.calling_format,
42394260
)
42404261
return conn
@@ -4259,6 +4280,7 @@ def test_list_buckets_anonymous():
42594280
@attr(method='get')
42604281
@attr(operation='list all buckets (bad auth)')
42614282
@attr(assertion='fails 403')
4283+
@attr('fails_on_rcs')
42624284
def test_list_buckets_invalid_auth():
42634285
conn = _create_connection_bad_auth()
42644286
e = assert_raises(boto.exception.S3ResponseError, conn.get_all_buckets)
@@ -4270,6 +4292,7 @@ def test_list_buckets_invalid_auth():
42704292
@attr(method='get')
42714293
@attr(operation='list all buckets (bad auth)')
42724294
@attr(assertion='fails 403')
4295+
@attr('fails_on_rcs')
42734296
def test_list_buckets_bad_auth():
42744297
conn = _create_connection_bad_auth(aws_access_key_id=s3.main.aws_access_key_id)
42754298
e = assert_raises(boto.exception.S3ResponseError, conn.get_all_buckets)
@@ -4393,6 +4416,7 @@ def test_object_copy_same_bucket():
43934416
@attr(method='put')
43944417
@attr(operation='copy object to itself')
43954418
@attr(assertion='fails')
4419+
@attr('fails_on_rcs')
43964420
def test_object_copy_to_itself():
43974421
bucket = get_new_bucket()
43984422
key = bucket.new_key('foo123bar')
@@ -4572,6 +4596,7 @@ def _multipart_upload(bucket, s3_key_name, size, part_size=5*1024*1024, do_list=
45724596
@attr(resource='object')
45734597
@attr(method='put')
45744598
@attr(operation='check multipart upload without parts')
4599+
@attr('fails_on_rcs')
45754600
def test_multipart_upload_empty():
45764601
bucket = get_new_bucket()
45774602
key = "mymultipart"
@@ -4690,6 +4715,7 @@ def test_multipart_upload_multiple_sizes():
46904715
@attr(method='put')
46914716
@attr(operation='check failure on multiple multi-part upload with size too small')
46924717
@attr(assertion='fails 400')
4718+
@attr('fails_on_rcs') # this is an artifact by enforce_multipart_part_size=false in r_t
46934719
def test_multipart_upload_size_too_small():
46944720
bucket = get_new_bucket()
46954721
key="mymultipart"
@@ -4803,7 +4829,7 @@ def test_list_multipart_upload():
48034829
upload2.cancel_upload()
48044830
upload3.cancel_upload()
48054831

4806-
def _simple_http_req_100_cont(host, port, is_secure, method, resource):
4832+
def _simple_http_req_100_cont(host, port, proxy, proxy_port, is_secure, method, resource):
48074833
"""
48084834
Send the specified request w/expect 100-continue
48094835
and await confirmation.
@@ -4818,7 +4844,10 @@ def _simple_http_req_100_cont(host, port, is_secure, method, resource):
48184844
if is_secure:
48194845
s = ssl.wrap_socket(s);
48204846
s.settimeout(5)
4821-
s.connect((host, port))
4847+
if proxy is None:
4848+
s.connect((host, port))
4849+
else:
4850+
s.connect((proxy, proxy_port))
48224851
s.send(req)
48234852

48244853
try:
@@ -4845,12 +4874,16 @@ def test_100_continue():
48454874
objname = 'testobj'
48464875
resource = '/{bucket}/{obj}'.format(bucket=bucket.name, obj=objname)
48474876

4848-
status = _simple_http_req_100_cont(s3.main.host, s3.main.port, s3.main.is_secure, 'PUT', resource)
4877+
status = _simple_http_req_100_cont(s3.main.host, s3.main.port,
4878+
s3.main.proxy, s3.main.proxy_port,
4879+
s3.main.is_secure, 'PUT', resource)
48494880
eq(status, '403')
48504881

48514882
bucket.set_acl('public-read-write')
48524883

4853-
status = _simple_http_req_100_cont(s3.main.host, s3.main.port, s3.main.is_secure, 'PUT', resource)
4884+
status = _simple_http_req_100_cont(s3.main.host, s3.main.port,
4885+
s3.main.proxy, s3.main.proxy_port,
4886+
s3.main.is_secure, 'PUT', resource)
48544887
eq(status, '100')
48554888

48564889
def _test_bucket_acls_changes_persistent(bucket):
@@ -4882,6 +4915,7 @@ def test_stress_bucket_acls_changes():
48824915
@attr(method='put')
48834916
@attr(operation='set cors')
48844917
@attr(assertion='succeeds')
4918+
@attr('cors')
48854919
def test_set_cors():
48864920
bucket = get_new_bucket()
48874921
cfg = CORSConfiguration()
@@ -4925,6 +4959,7 @@ def _cors_request_and_check(func, url, headers, expect_status, expect_allow_orig
49254959
@attr(method='get')
49264960
@attr(operation='check cors response when origin header set')
49274961
@attr(assertion='returning cors header')
4962+
@attr('cors')
49284963
def test_cors_origin_response():
49294964
cfg = CORSConfiguration()
49304965
bucket = get_new_bucket()
@@ -5096,6 +5131,8 @@ def _test_atomic_read(file_size):
50965131
is_secure=s3['main'].is_secure,
50975132
port=s3['main'].port,
50985133
host=s3['main'].host,
5134+
proxy=s3['main'].proxy,
5135+
proxy_port=s3['main'].proxy_port,
50995136
calling_format=s3['main'].calling_format,
51005137
)
51015138

0 commit comments

Comments
 (0)