Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 7eb83a8

Browse files
committed
fixed unit tests
1 parent c96dd25 commit 7eb83a8

2 files changed

Lines changed: 2 additions & 36 deletions

File tree

tests/unit/data/_metrics/test_data_model.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -535,16 +535,6 @@ def test_end_with_status_w_exception(self):
535535
final_op = handlers[0].on_operation_complete.call_args[0][0]
536536
assert final_op.final_status == expected_status
537537

538-
def test_interceptor_metadata(self):
539-
from google.cloud.bigtable.data._metrics.data_model import (
540-
OPERATION_INTERCEPTOR_METADATA_KEY,
541-
)
542-
543-
metric = self._make_one(mock.Mock())
544-
key, value = metric.interceptor_metadata
545-
assert key == OPERATION_INTERCEPTOR_METADATA_KEY
546-
assert value == metric.uuid
547-
548538
def test_end_with_status_with_default_cluster_zone(self):
549539
"""
550540
ending the operation should use default cluster and zone if not set

tests/unit/data/_metrics/test_metrics_controller.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@ def _make_one(self, *args, **kwargs):
2121
BigtableClientSideMetricsController,
2222
)
2323

24-
# add mock interceptor if called with no arguments
25-
if not args and "interceptor" not in kwargs:
26-
args = [mock.Mock()]
27-
2824
return BigtableClientSideMetricsController(*args, **kwargs)
2925

3026
def test_ctor_defaults(self):
3127
"""
3228
should create instance with GCP Exporter handler by default
3329
"""
34-
expected_interceptor = object()
35-
instance = self._make_one(expected_interceptor)
36-
assert instance.interceptor == expected_interceptor
30+
instance = self._make_one()
3731
assert len(instance.handlers) == 0
3832

3933
def ctor_custom_handlers(self):
@@ -92,22 +86,4 @@ def test_create_operation(self):
9286
assert op.is_streaming is expected_is_streaming
9387
assert op.zone is expected_zone
9488
assert len(op.handlers) == 1
95-
assert op.handlers[0] is handler
96-
97-
def test_create_operation_registers_interceptor(self):
98-
"""
99-
creating an operation should link the operation with the controller's interceptor,
100-
and add the interceptor as a handler to the operation
101-
"""
102-
from google.cloud.bigtable.data._sync_autogen.metrics_interceptor import (
103-
BigtableMetricsInterceptor,
104-
)
105-
106-
custom_handler = object()
107-
controller = self._make_one(
108-
BigtableMetricsInterceptor(), handlers=[custom_handler]
109-
)
110-
op = controller.create_operation(object())
111-
assert custom_handler in op.handlers
112-
assert op.uuid in controller.interceptor.operation_map
113-
assert controller.interceptor.operation_map[op.uuid] == op
89+
assert op.handlers[0] is handler

0 commit comments

Comments
 (0)