Skip to content

chore: Fix flaky testCreateAndUpdateTableWithPolicyTags test#4122

Open
lqiu96 wants to merge 1 commit intomainfrom
fix-taxonomy-flaky-test
Open

chore: Fix flaky testCreateAndUpdateTableWithPolicyTags test#4122
lqiu96 wants to merge 1 commit intomainfrom
fix-taxonomy-flaky-test

Conversation

@lqiu96
Copy link
Member

@lqiu96 lqiu96 commented Feb 28, 2026

Fixes #4097

@lqiu96 lqiu96 requested review from a team as code owners February 28, 2026 01:00
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: bigquery Issues related to the googleapis/java-bigquery API. labels Feb 28, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 flakiness issue in an integration test by enhancing the uniqueness of resource identifiers. The change ensures that parallel executions of the test do not interfere with each other due to name collisions, leading to more reliable test results and a stable testing environment.

Highlights

  • Flaky Test Fix: Addressed a known flakiness issue in the testCreateAndUpdateTableWithPolicyTags integration test by ensuring unique resource naming.
  • Unique DisplayName Generation: Switched from using Instant.now().getNano() to UUID.randomUUID().toString().substring(0, 8) for generating the DisplayName of a BigQuery Taxonomy, preventing collisions during parallel test runs.
Changelog
  • google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java
    • Updated the testCreateAndUpdateTableWithPolicyTags method to use a UUID-based approach for generating unique taxonomy display names, mitigating test flakiness.
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.

@lqiu96 lqiu96 requested a review from jinseopkim0 February 28, 2026 01:00
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a flaky test by using a UUID for generating a unique taxonomy display name, which is a good improvement. My feedback includes a suggestion to use the full UUID instead of a truncated one to make the fix more robust and prevent future collisions. I've also suggested a minor simplification to the string formatting for better readability.

Comment on lines +2088 to +2090
.setDisplayName(
String.format(
"testing taxonomy %s", UUID.randomUUID().toString().substring(0, 8)))
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While using a UUID is a great improvement for uniqueness over Instant.now().getNano(), truncating it to 8 characters reduces its entropy and still leaves a small chance of collision, which could lead to test flakiness in the future. To ensure uniqueness across the organization as the comment suggests, it would be more robust to use the full UUID. If there is a length limit for DisplayName, it would be helpful to document that with a comment.

Additionally, for simple string concatenation, using the + operator is often more readable and can be more efficient than String.format.

                      .setDisplayName("testing taxonomy " + UUID.randomUUID().toString())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/java-bigquery API. size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bigquery.it.ITNightlyBigQueryTest: testCreateAndUpdateTableWithPolicyTags failed

1 participant