tests: Tolerate NoSuchBucket errors when cleaning up

Sometimes we'll get back a 503 on the initial attempt, though the delete
succeeded on the backend. Then when the client automatically retries, it
gets back a 404.

Change-Id: I6d8d5af68884b08e22fd8a332f366a0b81acb7ed
This commit is contained in:
Tim Burke 2022-11-04 09:39:29 -07:00
parent 32600ee56b
commit 162847d151

View File

@ -190,6 +190,8 @@ class BaseS3TestCase(unittest.TestCase):
try:
client.delete_bucket(Bucket=bucket_name)
except ClientError as e:
if 'NoSuchBucket' in str(e):
return
if 'BucketNotEmpty' not in str(e):
raise
# Something's gone sideways. Try harder
@ -208,6 +210,8 @@ class BaseS3TestCase(unittest.TestCase):
try:
client.delete_bucket(Bucket=bucket_name)
except ClientError as e:
if 'NoSuchBucket' in str(e):
return
if 'BucketNotEmpty' not in str(e):
raise
if time.time() > timeout: