Skip to content

Conversation

@aIbrahiim
Copy link
Contributor

@aIbrahiim aIbrahiim commented Nov 11, 2025

Fixes: #30513

Error from logs: google.api_core.exceptions.NotFound: 404 DELETE https://storage.googleapis.com/storage/v1/b/gcsio-it-735-us-central1-d3d66207-1762710421?prettyPrint=false: The specified bucket does not exist.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aIbrahiim, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a recurring flakiness issue in the GCS integration tests, specifically within the test_create_default_bucket method. The previous implementation could fail with a NotFound error if it attempted to delete a GCS bucket that no longer existed. The changes introduce a check to verify the bucket's presence before deletion and gracefully handle NotFound exceptions, making the test more reliable and stable.

Highlights

  • Flaky Test Fix: Addressed a flaky GCS bucket deletion in test_create_default_bucket by ensuring the bucket exists before attempting to delete it.
  • Error Handling: Implemented robust error handling for bucket deletion by catching NotFound exceptions, preventing test failures if the bucket is already gone.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@aIbrahiim
Copy link
Contributor Author

@damccorm May you review please.

@Amar3tto Amar3tto requested a review from damccorm November 11, 2025 18:19
# verify soft delete policy is disabled by default in the default bucket
# after creation
self.assertEqual(bucket.soft_delete_policy.retention_duration_seconds, 0)
bucket.delete()
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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%

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@aIbrahiim aIbrahiim requested a review from damccorm November 11, 2025 19:15
Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@damccorm damccorm merged commit ce1b1dc into apache:master Nov 13, 2025
96 of 101 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The PostCommit Python job is flaky

2 participants