From dfc32b46e0dccb5a3598996ca540e5bc55b18c1d Mon Sep 17 00:00:00 2001 From: Uday Kurundwade Date: Fri, 10 Jan 2025 13:35:50 +0530 Subject: [PATCH] Adds delay before calling delete bucket operation to avoid intermittent BucketNotEmpty error Signed-off-by: Uday Kurundwade --- ocs_ci/ocs/resources/objectbucket.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ocs_ci/ocs/resources/objectbucket.py b/ocs_ci/ocs/resources/objectbucket.py index 89d5ab00f2d..19cc51a156f 100644 --- a/ocs_ci/ocs/resources/objectbucket.py +++ b/ocs_ci/ocs/resources/objectbucket.py @@ -480,10 +480,24 @@ def internal_delete(self): response = self.s3client.get_bucket_versioning(Bucket=self.name) logger.info(response) if "Status" in response and response["Status"] == "Enabled": + obj_versions = self.s3resource.Bucket(self.name).object_versions.all() + for obj_version in obj_versions: + logger.info(1111111111) + logger.info(obj_version.key) + logger.info(obj_version.version_id) + logger.info(2222222222) + obj_version.delete() + # Wait for 60 seconds after calling delete object API + sleep(60) + logger.info("aaaaaaaaaaaaaaaaaa") for obj_version in self.s3resource.Bucket( self.name ).object_versions.all(): - obj_version.delete() + logger.info(1111111111) + logger.info(obj_version.key) + logger.info(obj_version.version_id) + logger.info(2222222222) + else: self.s3resource.Bucket(self.name).objects.all().delete() if any("scale" in mark for mark in get_current_test_marks()):