Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds delay before calling delete bucket operation to avoid intermittent "BucketNotEmpty" error #11135

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion ocs_ci/ocs/resources/objectbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,25 @@ def internal_delete(self):
response = self.s3client.get_bucket_versioning(Bucket=self.name)
logger.info(response)
if "Status" in response and response["Status"] == "Enabled":
# Wait for 60 seconds after calling delete object API
sleep(30)
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()
sleep(30)
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
Loading