From bccc5bce25ed037112234348fc8658ef31f59207 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 22 Sep 2017 14:24:18 -0400 Subject: [PATCH] Retry whole batch of deletes on 429. Because 'Bucket.delete' inside a batch context manager is deferred, we cannot retry it directly. We also need to check for bucket existence, as the bucket *may* have been deleted in the previous batch before the 429 was raised. Closes #3761. --- storage/tests/system.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/tests/system.py b/storage/tests/system.py index e51cfcaeccb2..8c60cf6ffdad 100644 --- a/storage/tests/system.py +++ b/storage/tests/system.py @@ -82,11 +82,15 @@ class TestStorageBuckets(unittest.TestCase): def setUp(self): self.case_buckets_to_delete = [] - def tearDown(self): + def _delete_buckets(self): with Config.CLIENT.batch(): for bucket_name in self.case_buckets_to_delete: bucket = Config.CLIENT.bucket(bucket_name) - retry_429(bucket.delete)() + if bucket.exists(): + bucket.delete() + + def tearDown(self): + retry_429(self._delete_buckets)() def test_create_bucket(self): new_bucket_name = 'a-new-bucket' + unique_resource_id('-')