Skip to content

Commit

Permalink
More integ test bucket creation exception handling (#100)
Browse files Browse the repository at this point in the history
If a developer has already run the integ tests in one region and then
tries to run them from another, the tests will fail with an
IllegalLocationConstraintException, which is the error thrown when a
user attempts to access an existing bucket from _outside_ the region it
lives. This commit adds IllegalLocationConstraintException to the
exceptions to ignore.
  • Loading branch information
speller26 authored Jun 8, 2020
1 parent 1206ec1 commit 05c4e31
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/integ_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ def s3_bucket(s3_resource, boto_session):
try:
bucket.create(ACL="private", CreateBucketConfiguration={"LocationConstraint": region_name})
except ClientError as e:
if e.response["Error"]["Code"] == "BucketAlreadyOwnedByYou":
code = e.response["Error"]["Code"]

# Bucket exists in profile region
if code == "BucketAlreadyOwnedByYou":
pass
# Bucket exists in another region
elif code == "IllegalLocationConstraintException" and bucket.creation_date:
pass
else:
raise e
Expand Down

0 comments on commit 05c4e31

Please sign in to comment.