Skip to content

dataconnect(test): fix test flakiness in AuthIntegrationTest.kt#8023

Merged
dconeybe merged 2 commits intomainfrom
dconeybe/dataconnect/AuthIntegrationTestFlakyFixWithSignIn
Apr 8, 2026
Merged

dataconnect(test): fix test flakiness in AuthIntegrationTest.kt#8023
dconeybe merged 2 commits intomainfrom
dconeybe/dataconnect/AuthIntegrationTestFlakyFixWithSignIn

Conversation

@dconeybe
Copy link
Copy Markdown
Contributor

@dconeybe dconeybe commented Apr 8, 2026

Fixes test flakiness in AuthIntegrationTest.kt by ensuring that signIn() waits for auth to be ready on the correct FirebaseDataConnect instance and by introducing a response delay in the mock gRPC server to prevent the reuse of stale auth tokens from the emulator.

The delay works around behaviour of the Firebase Auth emulator that it will produce identical tokens if called in rapid succession because it uses the current time as a basis for the tokens that it returns.

Highlights

  • Updated AuthIntegrationTest to pass the FirebaseDataConnect instance to signIn(), ensuring the object is ready for auth operations.
  • Added a responseDelay parameter to InProcessDataConnectGrpcServer to simulate network latency and allow time for token updates.
  • Modified several tests in AuthIntegrationTest to use the new responseDelay, specifically to avoid receiving the same access token twice from the auth emulator during retries.

Changelog

View file-level changes
  • AuthIntegrationTest.kt: Refactored signIn to accept a dataConnect instance, updated test cases to use this instance, and added delays to tests that retry on unauthenticated errors.
  • InProcessDataConnectGrpcServer.kt: Added support for a configurable responseDelay in the mock gRPC server using a ServerInterceptor.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

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

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

@dconeybe
Copy link
Copy Markdown
Contributor Author

dconeybe commented Apr 8, 2026

/gemini review

Copy link
Copy Markdown
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 updates the InProcessDataConnectGrpcServer to support an optional responseDelay parameter, which is used to introduce a delay in gRPC server responses. This change is applied across several integration tests in AuthIntegrationTest.kt to prevent flakiness by ensuring the auth emulator has sufficient time to generate new tokens during retry attempts. Additionally, the signIn helper method was refactored to accept a FirebaseDataConnect instance directly, and the tests were updated to use this new signature. I have one piece of feedback regarding the queryShouldOnlyRetryOnUnauthenticatedOnce test, where adding a responseDelay would improve consistency with other similar tests.

…ldOnlyRetryOnUnauthenticatedOnce`, which was overlooked
@dconeybe dconeybe marked this pull request as ready for review April 8, 2026 19:40
@dconeybe dconeybe merged commit 7a7408b into main Apr 8, 2026
43 checks passed
@dconeybe dconeybe deleted the dconeybe/dataconnect/AuthIntegrationTestFlakyFixWithSignIn branch April 8, 2026 20:34
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.

2 participants