mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-25 03:47:22 +00:00
Merge pull request #285 from soumyakoduri/bucket-name-tests
Fix create_bucket tests as per new bucket naming conventions
This commit is contained in:
commit
6c766eb60b
1 changed files with 55 additions and 47 deletions
|
@ -3905,7 +3905,7 @@ def check_invalid_bucketname(invalid_name):
|
||||||
new_url = url.replace(valid_bucket_name, invalid_name)
|
new_url = url.replace(valid_bucket_name, invalid_name)
|
||||||
kwargs['params']['url'] = new_url
|
kwargs['params']['url'] = new_url
|
||||||
client.meta.events.register('before-call.s3.CreateBucket', replace_bucketname_from_url)
|
client.meta.events.register('before-call.s3.CreateBucket', replace_bucketname_from_url)
|
||||||
e = assert_raises(ClientError, client.create_bucket, Bucket=valid_bucket_name)
|
e = assert_raises(ClientError, client.create_bucket, Bucket=invalid_name)
|
||||||
status, error_code = _get_status_and_error_code(e.response)
|
status, error_code = _get_status_and_error_code(e.response)
|
||||||
return (status, error_code)
|
return (status, error_code)
|
||||||
|
|
||||||
|
@ -3913,6 +3913,8 @@ def check_invalid_bucketname(invalid_name):
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='empty name')
|
@attr(operation='empty name')
|
||||||
@attr(assertion='fails 405')
|
@attr(assertion='fails 405')
|
||||||
|
# TODO: remove this fails_on_rgw when I fix it
|
||||||
|
@attr('fails_on_rgw')
|
||||||
def test_bucket_create_naming_bad_short_empty():
|
def test_bucket_create_naming_bad_short_empty():
|
||||||
invalid_bucketname = ''
|
invalid_bucketname = ''
|
||||||
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
||||||
|
@ -3939,6 +3941,8 @@ def test_bucket_create_naming_bad_short_two():
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='excessively long names')
|
@attr(operation='excessively long names')
|
||||||
@attr(assertion='fails with subdomain: 400')
|
@attr(assertion='fails with subdomain: 400')
|
||||||
|
# TODO: remove this fails_on_rgw when I fix it
|
||||||
|
@attr('fails_on_rgw')
|
||||||
def test_bucket_create_naming_bad_long():
|
def test_bucket_create_naming_bad_long():
|
||||||
invalid_bucketname = 256*'a'
|
invalid_bucketname = 256*'a'
|
||||||
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
||||||
|
@ -3986,7 +3990,7 @@ def _test_bucket_create_naming_good_long(length):
|
||||||
# their own setup/teardown nukes, with their custom prefix; this
|
# their own setup/teardown nukes, with their custom prefix; this
|
||||||
# should be very rare
|
# should be very rare
|
||||||
prefix = get_new_bucket_name()
|
prefix = get_new_bucket_name()
|
||||||
assert len(prefix) < 255
|
assert len(prefix) < 63
|
||||||
num = length - len(prefix)
|
num = length - len(prefix)
|
||||||
name=num*'a'
|
name=num*'a'
|
||||||
|
|
||||||
|
@ -4002,73 +4006,57 @@ def _test_bucket_create_naming_good_long(length):
|
||||||
@attr('fails_with_subdomain')
|
@attr('fails_with_subdomain')
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/250 byte name')
|
@attr(operation='create w/60 byte name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails with subdomain')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
def test_bucket_create_naming_good_long_250():
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
_test_bucket_create_naming_good_long(250)
|
def test_bucket_create_naming_good_long_60():
|
||||||
|
_test_bucket_create_naming_good_long(60)
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
@attr('fails_with_subdomain')
|
@attr('fails_with_subdomain')
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/251 byte name')
|
@attr(operation='create w/61 byte name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails with subdomain')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
def test_bucket_create_naming_good_long_251():
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
_test_bucket_create_naming_good_long(251)
|
def test_bucket_create_naming_good_long_61():
|
||||||
|
_test_bucket_create_naming_good_long(61)
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
@attr('fails_with_subdomain')
|
@attr('fails_with_subdomain')
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/252 byte name')
|
@attr(operation='create w/62 byte name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails with subdomain')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
def test_bucket_create_naming_good_long_252():
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
_test_bucket_create_naming_good_long(252)
|
def test_bucket_create_naming_good_long_62():
|
||||||
|
_test_bucket_create_naming_good_long(62)
|
||||||
|
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
@attr('fails_with_subdomain')
|
@attr('fails_with_subdomain')
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/253 byte name')
|
@attr(operation='create w/63 byte name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails with subdomain')
|
||||||
def test_bucket_create_naming_good_long_253():
|
def test_bucket_create_naming_good_long_63():
|
||||||
_test_bucket_create_naming_good_long(253)
|
_test_bucket_create_naming_good_long(63)
|
||||||
|
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
|
||||||
@attr('fails_with_subdomain')
|
|
||||||
@attr(resource='bucket')
|
|
||||||
@attr(method='put')
|
|
||||||
@attr(operation='create w/254 byte name')
|
|
||||||
@attr(assertion='fails with subdomain')
|
|
||||||
def test_bucket_create_naming_good_long_254():
|
|
||||||
_test_bucket_create_naming_good_long(254)
|
|
||||||
|
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
|
||||||
@attr('fails_with_subdomain')
|
|
||||||
@attr(resource='bucket')
|
|
||||||
@attr(method='put')
|
|
||||||
@attr(operation='create w/255 byte name')
|
|
||||||
@attr(assertion='fails with subdomain')
|
|
||||||
def test_bucket_create_naming_good_long_255():
|
|
||||||
_test_bucket_create_naming_good_long(255)
|
|
||||||
|
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
@attr('fails_with_subdomain')
|
@attr('fails_with_subdomain')
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='get')
|
@attr(method='get')
|
||||||
@attr(operation='list w/251 byte name')
|
@attr(operation='list w/61 byte name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails with subdomain')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
def test_bucket_list_long_name():
|
def test_bucket_list_long_name():
|
||||||
prefix = get_new_bucket_name()
|
prefix = get_new_bucket_name()
|
||||||
length = 251
|
length = 61
|
||||||
num = length - len(prefix)
|
num = length - len(prefix)
|
||||||
name=num*'a'
|
name=num*'a'
|
||||||
|
|
||||||
|
@ -4110,10 +4098,14 @@ def test_bucket_create_naming_bad_punctuation():
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/underscore in name')
|
@attr(operation='create w/underscore in name')
|
||||||
@attr(assertion='succeeds')
|
@attr(assertion='fails')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
def test_bucket_create_naming_dns_underscore():
|
def test_bucket_create_naming_dns_underscore():
|
||||||
check_good_bucket_name('foo_bar')
|
invalid_bucketname = 'foo_bar'
|
||||||
|
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
||||||
|
eq(status, 400)
|
||||||
|
eq(error_code, 'InvalidBucketName')
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
@attr('fails_with_subdomain')
|
@attr('fails_with_subdomain')
|
||||||
|
@ -4125,7 +4117,7 @@ def test_bucket_create_naming_dns_underscore():
|
||||||
def test_bucket_create_naming_dns_long():
|
def test_bucket_create_naming_dns_long():
|
||||||
prefix = get_prefix()
|
prefix = get_prefix()
|
||||||
assert len(prefix) < 50
|
assert len(prefix) < 50
|
||||||
num = 100 - len(prefix)
|
num = 63 - len(prefix)
|
||||||
check_good_bucket_name(num * 'a')
|
check_good_bucket_name(num * 'a')
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
|
@ -4133,10 +4125,14 @@ def test_bucket_create_naming_dns_long():
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/dash at end of name')
|
@attr(operation='create w/dash at end of name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
def test_bucket_create_naming_dns_dash_at_end():
|
def test_bucket_create_naming_dns_dash_at_end():
|
||||||
check_good_bucket_name('foo-')
|
invalid_bucketname = 'foo-'
|
||||||
|
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
||||||
|
eq(status, 400)
|
||||||
|
eq(error_code, 'InvalidBucketName')
|
||||||
|
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
|
@ -4144,10 +4140,14 @@ def test_bucket_create_naming_dns_dash_at_end():
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/.. in name')
|
@attr(operation='create w/.. in name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
def test_bucket_create_naming_dns_dot_dot():
|
def test_bucket_create_naming_dns_dot_dot():
|
||||||
check_good_bucket_name('foo..bar')
|
invalid_bucketname = 'foo..bar'
|
||||||
|
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
||||||
|
eq(status, 400)
|
||||||
|
eq(error_code, 'InvalidBucketName')
|
||||||
|
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
|
@ -4155,10 +4155,14 @@ def test_bucket_create_naming_dns_dot_dot():
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/.- in name')
|
@attr(operation='create w/.- in name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
def test_bucket_create_naming_dns_dot_dash():
|
def test_bucket_create_naming_dns_dot_dash():
|
||||||
check_good_bucket_name('foo.-bar')
|
invalid_bucketname = 'foo.-bar'
|
||||||
|
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
||||||
|
eq(status, 400)
|
||||||
|
eq(error_code, 'InvalidBucketName')
|
||||||
|
|
||||||
|
|
||||||
# Breaks DNS with SubdomainCallingFormat
|
# Breaks DNS with SubdomainCallingFormat
|
||||||
|
@ -4166,10 +4170,14 @@ def test_bucket_create_naming_dns_dot_dash():
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
@attr(operation='create w/-. in name')
|
@attr(operation='create w/-. in name')
|
||||||
@attr(assertion='fails with subdomain')
|
@attr(assertion='fails')
|
||||||
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
@attr('fails_on_aws') # <Error><Code>InvalidBucketName</Code><Message>The specified bucket is not valid.</Message>...</Error>
|
||||||
|
# Should now pass on AWS even though it has 'fails_on_aws' attr.
|
||||||
def test_bucket_create_naming_dns_dash_dot():
|
def test_bucket_create_naming_dns_dash_dot():
|
||||||
check_good_bucket_name('foo-.bar')
|
invalid_bucketname = 'foo-.bar'
|
||||||
|
status, error_code = check_invalid_bucketname(invalid_bucketname)
|
||||||
|
eq(status, 400)
|
||||||
|
eq(error_code, 'InvalidBucketName')
|
||||||
|
|
||||||
@attr(resource='bucket')
|
@attr(resource='bucket')
|
||||||
@attr(method='put')
|
@attr(method='put')
|
||||||
|
|
Loading…
Reference in a new issue