Repository navigation
Conversation
mutianf
force-pushed
the
fix-bigtableio-test-mocks
branch
3 times, most recently
from
October 1, 2026 13:27
a8e0b06 to
cb91f14
Compare
mutianf
marked this pull request as ready for review
October 1, 2026 13:34
mutianf
force-pushed
the
fix-bigtableio-test-mocks
branch
from
October 1, 2026 13:48
cb91f14 to
f17c368
Compare
Contributor
|
Assigning reviewers: R: @shunping for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Collaborator
|
waiting on author |
…tcher delegation In google-cloud-bigtable >= 2.48.0 (PR apache#18200), MutationsBatcher delegates directly to the underlying data client batcher via table._table_impl.mutations_batcher instead of calling Table.mutate_rows. When using a mock Bigtable client in tests, table._table_impl was an unconfigured mock returning a default batcher whose close() was a no-op, causing Table.mutate_rows to be bypassed and leaving exceptions and batch completion callbacks un-triggered. In TestWriteBigTable.setUp, configure the mock batcher on table._table_impl.mutations_batcher to invoke Table.mutate_rows and forward the results to the registered batch completion callback. This ensures tests patching Table.mutate_rows (test_write_metrics, test_write_batch_error_surfaces_from_async_flush, and test_write_batch_error_surfaces_from_buffered_rows) work seamlessly across both legacy and modern client versions while keeping production code untouched.
mutianf
force-pushed
the
fix-bigtableio-test-mocks
branch
from
October 7, 2026 18:42
f17c368 to
03e0dc5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40365 +/- ##
============================================
- Coverage 59.04% 59.01% -0.03%
+ Complexity 15624 15616 -8
============================================
Files 2797 2798 +1
Lines 280750 280841 +91
Branches 12488 12477 -11
============================================
- Hits 165764 165744 -20
- Misses 108540 108656 +116
+ Partials 6446 6441 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
In newer versions of
google-cloud-bigtable(>= 2.48.0 / PR #18200),MutationsBatcherdelegates directly to the underlying data client batcher (table._table_impl.mutations_batcher) instead of invokingTable.mutate_rows. As a result, tests inbigtableio_test.pythat patchedTable.mutate_rowsbypassed the mocked behaviors.Proposed Changes
Update
sdks/python/apache_beam/io/gcp/bigtableio_test.py:test_write_metrics:MutationsBatcheris initialized withwrite_fn.write_mutate_metricsas the batch completion callback.test_write_batch_error_surfaces_from_async_flush:Table.mutate_rows.test_write_batch_error_surfaces_from_buffered_rows:bigtableio.pyremains untouched.google-cloud-bigtableversions.Verification
Table.mutate_rowsand new data client batcher delegation paths.test_write_metrics,test_write_batch_error_surfaces_from_async_flush, andtest_write_batch_error_surfaces_from_buffered_rows.