From 162847d15141d1948ca45190166c7160bd6931c5 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Fri, 4 Nov 2022 09:39:29 -0700 Subject: [PATCH] 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 --- test/s3api/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/s3api/__init__.py b/test/s3api/__init__.py index ebfc0fe646..45a2a84a12 100644 --- a/test/s3api/__init__.py +++ b/test/s3api/__init__.py @@ -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: