Skip to content

Update to upstream HEAD and changes for Riak CS 2.1 release #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions s3tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def connect(conf):
mapping = dict(
port='port',
host='host',
proxy='proxy',
proxy_port='proxy_port',
is_secure='is_secure',
access_key='aws_access_key_id',
secret_key='aws_secret_access_key',
Expand Down
12 changes: 12 additions & 0 deletions s3tests/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,16 @@ def setup():
regions.add(name, TargetConfig(cfg, section))

for section in cfg.sections():
try:
proxy = cfg.get(section, 'proxy')
except ConfigParser.NoOptionError:
proxy = None

try:
proxy_port = cfg.getint(section, 'proxy_port')
except ConfigParser.NoOptionError:
proxy_port = None

try:
(type_, name) = section.split(None, 1)
except ValueError:
Expand Down Expand Up @@ -323,6 +333,8 @@ def setup():
aws_access_key_id=cfg.get(section, 'access_key'),
aws_secret_access_key=cfg.get(section, 'secret_key'),
is_secure=conf.is_secure,
proxy=proxy,
proxy_port=proxy_port,
port=conf.port,
host=conf.host,
# TODO test vhost calling format
Expand Down
53 changes: 45 additions & 8 deletions s3tests/functional/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def validate_bucket_list(bucket, prefix, delimiter, marker, max_keys,
@attr(method='get')
@attr(operation='list')
@attr(assertion='prefixes in multi-component object names')
@attr('fails_on_rcs')
def test_bucket_list_delimiter_prefix():
bucket = _create_keys(keys=['asdf', 'boo/bar', 'boo/baz/xyzzy', 'cquux/thud', 'cquux/bla'])

Expand Down Expand Up @@ -994,6 +995,7 @@ def test_object_set_get_unicode_metadata():
@attr(operation='metadata write/re-write')
@attr(assertion='non-UTF-8 values detected, but preserved')
@attr('fails_strict_rfc2616')
@attr('fails_on_rcs')
def test_object_set_get_non_utf8_metadata():
bucket = get_new_bucket()
key = boto.s3.key.Key(bucket)
Expand Down Expand Up @@ -1022,6 +1024,7 @@ def _set_get_metadata_unreadable(metadata, bucket=None):
@attr(operation='metadata write')
@attr(assertion='non-priting prefixes noted and preserved')
@attr('fails_strict_rfc2616')
@attr('fails_on_rcs')
def test_object_set_get_metadata_empty_to_unreadable_prefix():
metadata = '\x04w'
got = _set_get_metadata_unreadable(metadata)
Expand All @@ -1033,6 +1036,7 @@ def test_object_set_get_metadata_empty_to_unreadable_prefix():
@attr(operation='metadata write')
@attr(assertion='non-priting suffixes noted and preserved')
@attr('fails_strict_rfc2616')
@attr('fails_on_rcs')
def test_object_set_get_metadata_empty_to_unreadable_suffix():
metadata = 'h\x04'
got = _set_get_metadata_unreadable(metadata)
Expand All @@ -1043,6 +1047,7 @@ def test_object_set_get_metadata_empty_to_unreadable_suffix():
@attr(method='put')
@attr(operation='metadata write')
@attr(assertion='non-priting in-fixes noted and preserved')
@attr('fails_on_rcs')
def test_object_set_get_metadata_empty_to_unreadable_infix():
metadata = 'h\x04w'
got = _set_get_metadata_unreadable(metadata)
Expand All @@ -1054,6 +1059,7 @@ def test_object_set_get_metadata_empty_to_unreadable_infix():
@attr(operation='metadata re-write')
@attr(assertion='non-priting prefixes noted and preserved')
@attr('fails_strict_rfc2616')
@attr('fails_on_rcs')
def test_object_set_get_metadata_overwrite_to_unreadable_prefix():
metadata = '\x04w'
got = _set_get_metadata_unreadable(metadata)
Expand All @@ -1068,6 +1074,7 @@ def test_object_set_get_metadata_overwrite_to_unreadable_prefix():
@attr(operation='metadata re-write')
@attr(assertion='non-priting suffixes noted and preserved')
@attr('fails_strict_rfc2616')
@attr('fails_on_rcs')
def test_object_set_get_metadata_overwrite_to_unreadable_suffix():
metadata = 'h\x04'
got = _set_get_metadata_unreadable(metadata)
Expand All @@ -1081,6 +1088,7 @@ def test_object_set_get_metadata_overwrite_to_unreadable_suffix():
@attr(method='put')
@attr(operation='metadata re-write')
@attr(assertion='non-priting in-fixes noted and preserved')
@attr('fails_on_rcs')
def test_object_set_get_metadata_overwrite_to_unreadable_infix():
metadata = 'h\x04w'
got = _set_get_metadata_unreadable(metadata)
Expand Down Expand Up @@ -2131,7 +2139,7 @@ def test_put_object_ifmatch_good():
got_data = key.get_contents_as_string()
eq(got_data, 'bar')

key.set_contents_from_string('zar', headers={'If-Match': key.etag.replace('"', '').strip()})
key.set_contents_from_string('zar', headers={'If-Match': key.etag.strip()})
got_new_data = key.get_contents_as_string()
eq(got_new_data, 'zar')

Expand Down Expand Up @@ -2223,7 +2231,7 @@ def test_put_object_ifnonmatch_failed():
eq(got_data, 'bar')

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

c = class_(s3.main.host, s3.main.port, strict=True)
if s3.main.proxy is None:
c = class_(s3.main.host, s3.main.port, strict=True)
else:
c = class_(s3.main.proxy, s3.main.proxy_port, strict=True)
c.request(method, path, body=body)
res = c.getresponse()

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

c = class_(s3.main.host, s3.main.port, strict=True)
if s3.main.proxy is None:
c = class_(s3.main.host, s3.main.port, strict=True)
else:
c = class_(s3.main.proxy, s3.main.proxy_port, strict=True)
c.request(method, path, body=body)
res = c.getresponse()

Expand Down Expand Up @@ -2487,6 +2501,7 @@ def test_object_raw_authenticated():
@attr(operation='authenticated on private bucket/private object with modified response headers')
@attr(assertion='succeeds')
@attr('fails_on_rgw')
@attr('fails_on_rcs')
def test_object_raw_response_headers():
(bucket, key) = _setup_request('private', 'private')

Expand Down Expand Up @@ -2819,6 +2834,7 @@ def test_bucket_create_naming_bad_punctuation():
@attr(method='put')
@attr(operation='create w/underscore in name')
@attr(assertion='succeeds')
@attr('fails_on_rcs')
def test_bucket_create_naming_dns_underscore():
check_good_bucket_name('foo_bar')

Expand Down Expand Up @@ -3377,6 +3393,7 @@ def test_object_acl_canned_bucketownerfullcontrol():
@attr(method='put')
@attr(operation='set write-acp')
@attr(assertion='does not modify owner')
@attr('fails_on_rcs')
def test_object_acl_full_control_verify_owner():
bucket = get_new_bucket(targets.main.default)
bucket.set_acl('public-read-write')
Expand Down Expand Up @@ -3810,6 +3827,7 @@ def _get_acl_header(user=None, perms=None):
@attr(operation='add all grants to user through headers')
@attr(assertion='adds all grants individually to second user')
@attr('fails_on_dho')
@attr('fails_on_rcs')
def test_object_header_acl_grants():
bucket = get_new_bucket()
headers = _get_acl_header()
Expand Down Expand Up @@ -3869,6 +3887,7 @@ def test_object_header_acl_grants():
@attr(operation='add all grants to user through headers')
@attr(assertion='adds all grants individually to second user')
@attr('fails_on_dho')
@attr('fails_on_rcs')
def test_bucket_header_acl_grants():
headers = _get_acl_header()
bucket = get_new_bucket(targets.main.default, get_prefix(), headers)
Expand Down Expand Up @@ -4235,6 +4254,8 @@ def _create_connection_bad_auth(aws_access_key_id='badauth'):
is_secure=main.is_secure,
port=main.port,
host=main.host,
proxy=main.proxy,
proxy_port=main.proxy_port,
calling_format=main.calling_format,
)
return conn
Expand All @@ -4259,6 +4280,7 @@ def test_list_buckets_anonymous():
@attr(method='get')
@attr(operation='list all buckets (bad auth)')
@attr(assertion='fails 403')
@attr('fails_on_rcs')
def test_list_buckets_invalid_auth():
conn = _create_connection_bad_auth()
e = assert_raises(boto.exception.S3ResponseError, conn.get_all_buckets)
Expand All @@ -4270,6 +4292,7 @@ def test_list_buckets_invalid_auth():
@attr(method='get')
@attr(operation='list all buckets (bad auth)')
@attr(assertion='fails 403')
@attr('fails_on_rcs')
def test_list_buckets_bad_auth():
conn = _create_connection_bad_auth(aws_access_key_id=s3.main.aws_access_key_id)
e = assert_raises(boto.exception.S3ResponseError, conn.get_all_buckets)
Expand Down Expand Up @@ -4393,6 +4416,7 @@ def test_object_copy_same_bucket():
@attr(method='put')
@attr(operation='copy object to itself')
@attr(assertion='fails')
@attr('fails_on_rcs')
def test_object_copy_to_itself():
bucket = get_new_bucket()
key = bucket.new_key('foo123bar')
Expand Down Expand Up @@ -4572,6 +4596,7 @@ def _multipart_upload(bucket, s3_key_name, size, part_size=5*1024*1024, do_list=
@attr(resource='object')
@attr(method='put')
@attr(operation='check multipart upload without parts')
@attr('fails_on_rcs')
def test_multipart_upload_empty():
bucket = get_new_bucket()
key = "mymultipart"
Expand Down Expand Up @@ -4690,6 +4715,7 @@ def test_multipart_upload_multiple_sizes():
@attr(method='put')
@attr(operation='check failure on multiple multi-part upload with size too small')
@attr(assertion='fails 400')
@attr('fails_on_rcs') # this is an artifact by enforce_multipart_part_size=false in r_t
def test_multipart_upload_size_too_small():
bucket = get_new_bucket()
key="mymultipart"
Expand Down Expand Up @@ -4803,7 +4829,7 @@ def test_list_multipart_upload():
upload2.cancel_upload()
upload3.cancel_upload()

def _simple_http_req_100_cont(host, port, is_secure, method, resource):
def _simple_http_req_100_cont(host, port, proxy, proxy_port, is_secure, method, resource):
"""
Send the specified request w/expect 100-continue
and await confirmation.
Expand All @@ -4818,7 +4844,10 @@ def _simple_http_req_100_cont(host, port, is_secure, method, resource):
if is_secure:
s = ssl.wrap_socket(s);
s.settimeout(5)
s.connect((host, port))
if proxy is None:
s.connect((host, port))
else:
s.connect((proxy, proxy_port))
s.send(req)

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

status = _simple_http_req_100_cont(s3.main.host, s3.main.port, s3.main.is_secure, 'PUT', resource)
status = _simple_http_req_100_cont(s3.main.host, s3.main.port,
s3.main.proxy, s3.main.proxy_port,
s3.main.is_secure, 'PUT', resource)
eq(status, '403')

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

status = _simple_http_req_100_cont(s3.main.host, s3.main.port, s3.main.is_secure, 'PUT', resource)
status = _simple_http_req_100_cont(s3.main.host, s3.main.port,
s3.main.proxy, s3.main.proxy_port,
s3.main.is_secure, 'PUT', resource)
eq(status, '100')

def _test_bucket_acls_changes_persistent(bucket):
Expand Down Expand Up @@ -4882,6 +4915,7 @@ def test_stress_bucket_acls_changes():
@attr(method='put')
@attr(operation='set cors')
@attr(assertion='succeeds')
@attr('cors')
def test_set_cors():
bucket = get_new_bucket()
cfg = CORSConfiguration()
Expand Down Expand Up @@ -4925,6 +4959,7 @@ def _cors_request_and_check(func, url, headers, expect_status, expect_allow_orig
@attr(method='get')
@attr(operation='check cors response when origin header set')
@attr(assertion='returning cors header')
@attr('cors')
def test_cors_origin_response():
cfg = CORSConfiguration()
bucket = get_new_bucket()
Expand Down Expand Up @@ -5096,6 +5131,8 @@ def _test_atomic_read(file_size):
is_secure=s3['main'].is_secure,
port=s3['main'].port,
host=s3['main'].host,
proxy=s3['main'].proxy,
proxy_port=s3['main'].proxy_port,
calling_format=s3['main'].calling_format,
)

Expand Down