-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix flaky GCS bucket deletion in test_create_default_bucket #36786
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
Merged
damccorm
merged 2 commits into
apache:master
from
aIbrahiim:30513-fix-postcommit-python
Nov 13, 2025
+21
−3
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is changing the underlying test - if the bucket doesn't exist, that means that we should be failing the test (this just covers up potentially flaky actual behavior). Do you know why this is happening? Is it because tests are overwriting the same bucket name, a timing issue, or are we actually failing to create these buckets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh absolutely right, then this masks the issue as I wasn't aware that the test should fail if bucket doesnt exists but when i was investigating the test class i found out that:
get_or_create_default_gcs_bucket() creates/gets bucket by create_bucket()
then wait 60 seconds for propagation
then it asserts the bucket exists using the object returned from creation
after that it make a fresh call by get_bucket() to lookup_bucket() which may hit a different gcs endpoint or cache layer
even after the 60 seconds wait lookup_bucket() might not immediately see the newly created bucket maybe because
different api endpoints create_bucket or lookup_bucket having different cache states or gcs eventual consistency across regions or even caches, also does create_bucket() and lookup_bucket() may hit different gcs endpoints or caches?
and it might be name collisions as multiple test runs using the same random bucket names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before doing this, could we try retrying the call on failure several times (maybe 5)? Then if the bucket still is not found, we can pass
Also, how often is this flaking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the last 9 runs, we have 2 failures out of 8 completed runs (excluding 1 cancelled), giving us a 25%