mutianf opened a new pull request, #40365:
URL: https://github.com/apache/beam/pull/40365
## Context
In newer versions of `google-cloud-bigtable` (>= 2.30.0 / PR #18200),
`MutationsBatcher` delegates directly to the underlying data client batcher
(`table._table_impl.mutations_batcher`) instead of invoking
`Table.mutate_rows`. As a result, tests in `bigtableio_test.py` that patched
`Table.mutate_rows` bypassed the mocked behaviors.
## Proposed Changes
Update `sdks/python/apache_beam/io/gcp/bigtableio_test.py`:
- `test_write_metrics`:
- Verify that `MutationsBatcher` is initialized with
`write_fn.write_mutate_metrics` as the batch completion callback.
- Wire mock completion callback to simulate batch completion and verify
metrics are properly recorded.
- `test_write_batch_error_surfaces_from_async_flush`:
- Simulate background batch error surfacing on batcher close without
relying solely on `Table.mutate_rows`.
- `test_write_batch_error_surfaces_from_buffered_rows`:
- Intercept underlying batcher close/flush and verify buffered rows
trigger flush and propagate errors.
- Ensure production code `bigtableio.py` remains untouched.
- Maintain backward compatibility with older `google-cloud-bigtable`
versions.
## Verification
- Validated test behaviors against both legacy `Table.mutate_rows` and new
data client batcher delegation paths.
- Verified all assertions in `test_write_metrics`,
`test_write_batch_error_surfaces_from_async_flush`, and
`test_write_batch_error_surfaces_from_buffered_rows`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]