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

test: add retry in test fixtures #1108

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions tests/system/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ def empty_bucket(bucket):


def delete_blob(blob):
errors = (exceptions.Conflict, exceptions.TooManyRequests)
errors = (
exceptions.Conflict,
exceptions.TooManyRequests,
exceptions.ServiceUnavailable,
)
retry = RetryErrors(errors)
try:
retry(blob.delete)(timeout=120) # seconds
Expand All @@ -105,7 +109,11 @@ def delete_blob(blob):


def delete_bucket(bucket):
errors = (exceptions.Conflict, exceptions.TooManyRequests)
errors = (
exceptions.Conflict,
exceptions.TooManyRequests,
exceptions.ServiceUnavailable,
)
retry = RetryErrors(errors, max_tries=15)
retry(empty_bucket)(bucket)
retry(bucket.delete)(force=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ def test_new_bucket_with_autoclass(

# Autoclass can be enabled/disabled via bucket patch
bucket.autoclass_enabled = False
bucket.patch()
bucket.patch(if_metageneration_match=bucket.metageneration)

assert bucket.autoclass_enabled is False
assert bucket.autoclass_toggle_time != previous_toggle_time