Skip to content

Commit

Permalink
Adds delay before calling delete bucket operation to avoid intermitte…
Browse files Browse the repository at this point in the history
…nt BucketNotEmpty error

Signed-off-by: Uday Kurundwade <[email protected]>
  • Loading branch information
udaysk23 committed Jan 10, 2025
1 parent 628f60b commit dfc32b4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ocs_ci/ocs/resources/objectbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()):
Expand Down

0 comments on commit dfc32b4

Please sign in to comment.