mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-22 09:29:43 +00:00
Fix create_bucket tests as per new bucket naming conventions
As per amazon s3 spec - https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html The s3 bucket names should not contain upper case letters or underscore. Name cannot end with dash or have consecutive periods, or dashes adjacent to periods Name length shouldn't exceed 63 characters. These rules are being enforced via - https://github.com/ceph/ceph/pull/26787 This patch is to update the respective testcases as well. Note: check_invalid_bucket_name() seems to have been broken. It should try to create bucket using invalid name. Have addressed it in this patch. Because of this few testcases (which were incorrectly passing earlier) are failing in validate_bucket_name. Have marked them 'fails_on_rgw' as done for test_bucket_create_naming_bad_punctuation Signed-off-by: Soumya Koduri <skoduri@redhat.com>
This commit is contained in:
parent
ae3ab351c8
commit
15d4dd96c5
1 changed files with 55 additions and 47 deletions
|
@ -3953,7 +3953,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)
|
||||||
|
|
||||||
|
@ -3961,6 +3961,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)
|
||||||
|
@ -3987,6 +3989,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)
|
||||||
|
@ -4034,7 +4038,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'
|
||||||
|
|
||||||
|
@ -4050,73 +4054,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'
|
||||||
|
|
||||||
|
@ -4158,10 +4146,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')
|
||||||
|
@ -4173,7 +4165,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
|
||||||
|
@ -4181,10 +4173,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
|
||||||
|
@ -4192,10 +4188,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
|
||||||
|
@ -4203,10 +4203,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
|
||||||
|
@ -4214,10 +4218,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