]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Merge pull request #30 from andrewgaul/bucket-create-exists
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 18 Dec 2015 17:49:10 +0000 (09:49 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 18 Dec 2015 17:49:10 +0000 (09:49 -0800)
Handle idempotent and BucketAlreadyOwnedByYou

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
1  2 
s3tests/functional/test_s3.py

index ac8625fe5a55b134a1133c076cbdd9737e1913f3,6b5a8e8851608b2906f243ff72f7e90192572d20..b9c3537a13ae1dece237be055f284a344e051893
@@@ -2990,23 -2628,18 +2990,28 @@@ def test_bucket_create_naming_dns_dash_
  @attr(resource='bucket')
  @attr(method='put')
  @attr(operation='re-create')
- @attr(assertion='idempotent success')
  def test_bucket_create_exists():
+     # aws-s3 default region allows recreation of buckets
+     # but all other regions fail with BucketAlreadyOwnedByYou.
      bucket = get_new_bucket(targets.main.default)
-     # REST idempotency means this should be a nop
-     get_new_bucket(targets.main.default, bucket.name)
+     try:
+         get_new_bucket(targets.main.default, bucket.name)
+     except boto.exception.S3CreateError, e:
+         eq(e.status, 409)
+         eq(e.reason, 'Conflict')
+         eq(e.error_code, 'BucketAlreadyOwnedByYou')
  
  
 +@attr(resource='bucket')
 +@attr(method='get')
 +@attr(operation='get location')
 +def test_bucket_get_location():
 +    bucket = get_new_bucket(targets.main.default)
 +    actual_location = bucket.get_location()
 +    expected_location = targets.main.default.conf.api_name
 +    eq(actual_location, expected_location)
 +
 +
  @attr(resource='bucket')
  @attr(method='put')
  @attr(operation='re-create by non-owner')