Skip to content

Commit

Permalink
refactor: retry readiness check S3 bucket creation with default config
Browse files Browse the repository at this point in the history
  • Loading branch information
LucySuddenly committed Nov 21, 2024
1 parent 82f8ede commit b90e1b1
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,16 @@ def is_enabled(self) -> bool:
return is_enabled

def _setup_bucket(self):
self.log.info(f'setting up test s3 bucket ({self.test_bucket_name})')
self.s3.create_bucket(Bucket=self.test_bucket_name, CreateBucketConfiguration={
'LocationConstraint': self.test_bucket_region})
self.log.info(f'setting up test s3 bucket ({self.test_bucket_name}) with LocationConstraint ({self.test_bucket_region})')
try:
self.s3.create_bucket(Bucket=self.test_bucket_name, CreateBucketConfiguration={
'LocationConstraint': self.test_bucket_region})
self.log.info(f'test s3 bucket ({self.test_bucket_name}) created')
except Exception as e:
self.log.info(f'failed to create test s3 bucket ({self.test_bucket_name}) with LocationConstraint ({self.test_bucket_region}) - exception: {e} - retrying without LocationConstraint, please request access to S3Select')
self.s3.create_bucket(Bucket=self.test_bucket_name)
self.log.info(f'test s3 bucket ({self.test_bucket_name}) created without LocationConstraint')


def _cleanup_bucket(self):
self.log.info(f'cleaning up test s3 bucket ({self.test_bucket_name})')
Expand Down

0 comments on commit b90e1b1

Please sign in to comment.