dataconnect(test): AuthIntegrationTest.kt: added realtime query subscription tests#8341
Conversation
…ription tests [no ci]
Using Gemini Code AssistThe 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
Customization To customize the 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 Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces authenticated operations for realtime queries and mutations, along with comprehensive integration tests verifying subscription behavior under different authentication states (unauthenticated, authenticated, and user changes). The reviewer feedback suggests adding convenience overloads to the newly introduced GetStringByKeyQueryAuth and InsertStringMutationAuth classes to maintain consistency with existing query and mutation helpers.
📝 PRs merging into main branchOur 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. |
This PR introduces integration tests for data connect's real-time query subscriptions for validating behavior across different authentication states. To support these tests, new authenticated query and mutation operations are added to the real-time test schema, and client wrapper properties are exposed in the generated
RealtimeConnectorclass.Highlights
AuthIntegrationTest.ktto verify that real-time query subscriptions correctly enforce authorization rules, successfully receive streaming updates when authenticated, and raise aFirebaseUserChangedExceptionwhen user sign-in or sign-out events occur during an active subscription.realtime_ops.gqlto defineRealtimeString_Insert_AuthandRealtimeString_GetByKey_Authwith anonymous user authorization level. Exposed correspondinginsertStringAuthandgetStringByKeyAuthmethods in the generatedRealtimeConnectorclass, along with newqueryRefconvenience overloads.signInandsignOuthelper methods inAuthIntegrationTest.ktto dynamically extract theFirebaseAuthinstance from instrumentation arguments rather than relying on a hardcoded instance, and introduced overloaded helpers acceptingPersonSchemato simplify test code.Changelog
RealtimeString_Insert_Authmutation andRealtimeString_GetByKey_Authquery, both restricted to theUSER_ANONauthorization level.insertStringAuth(InsertStringMutationAuth) andgetStringByKeyAuth(GetStringByKeyQueryAuth) properties to support authenticated client calls.queryRefhelper overloads takingStringandUUIDto streamline querying by ID.realtimeQuerySubscriptionUnauthenticated,realtimeQuerySubscriptionAuthenticated,realtimeQuerySubscriptionErrorsOnSignIn, andrealtimeQuerySubscriptionErrorsOnSignOuttest cases.signInandsignOuthelpers to dynamically retrieve theFirebaseAuthinstance for the given Firebase App using instrumentation arguments.signInandsignOuthelper overloads taking aPersonSchemaparameter.