Skip to content

test(spanner): initialize _client_info with ClientInfo instance in mock client - #18009

Merged
sakthivelmanii merged 1 commit into
mainfrom
fix-spanner-test-client-info-mock
Aug 6, 2026
Merged

test(spanner): initialize _client_info with ClientInfo instance in mock client#18009
sakthivelmanii merged 1 commit into
mainfrom
fix-spanner-test-client-info-mock

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor

Replace CrossSync.Mock() and mock.Mock() with gapic_v1.client_info.ClientInfo() in _Client test helper mocks in test_database.py and _async/test_database.py.

In google-api-core (PR #17616), GapicCallable pre-extracts the metrics header from metadata at initialization time via client_info.to_grpc_metadata(). Using an AsyncMock or Mock for client_info caused to_grpc_metadata() to return a coroutine or Mock object instead of the expected (key, value) metadata tuple, leading to a TypeError in core_deps_from_source sessions.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

…ck client

Replace CrossSync.Mock() and mock.Mock() with gapic_v1.client_info.ClientInfo() in _Client test helper mocks in test_database.py and _async/test_database.py.

In google-api-core (PR #17616), GapicCallable pre-extracts the metrics header from metadata at initialization time via client_info.to_grpc_metadata(). Using an AsyncMock or Mock for client_info caused to_grpc_metadata() to return a coroutine or Mock object instead of the expected (key, value) metadata tuple, leading to a TypeError in core_deps_from_source sessions.
@sakthivelmanii
sakthivelmanii requested a review from a team as a code owner August 6, 2026 07:54

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

Copy link
Copy Markdown
Contributor

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 unit tests for the Google Cloud Spanner database by replacing mock client info objects with concrete gapic_v1.client_info.ClientInfo() instances in both synchronous and asynchronous test files. There are no review comments, so I have no feedback to provide.

@sakthivelmanii
sakthivelmanii merged commit f1213c3 into main Aug 6, 2026
43 checks passed
@sakthivelmanii
sakthivelmanii deleted the fix-spanner-test-client-info-mock branch August 6, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants