Skip to content

Commit e3c2031

Browse files
committed
test(secretmanager): rename channel wrapper terminology to interceptor in tests
1 parent af928c1 commit e3c2031

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

packages/google-cloud-secret-manager/tests/unit/gapic/secretmanager_v1/test_observability.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from google.api_core import _observability
2323
from google.api_core._feature_gating_helpers import FeatureGatingError
2424
from google.auth.credentials import AnonymousCredentials
25-
2625
from google.cloud.secretmanager_v1 import (
2726
SecretManagerServiceAsyncClient,
2827
SecretManagerServiceClient,
@@ -204,26 +203,26 @@ def test_otel_tracing_feature_gating_error(
204203
)
205204

206205

207-
def test_otel_tracing_custom_channel_with_wrappers(
206+
def test_otel_tracing_custom_channel_with_interceptors(
208207
fake_grpc_server,
209208
otel_in_memory,
210209
monkeypatch,
211210
):
212-
"""Verify that when a custom channel is passed explicitly to the transport with wrappers,
211+
"""Verify that when a custom channel is passed explicitly to the transport with interceptors,
213212
OpenTelemetry tracing wraps the custom channel and records spans.
214213
"""
215214
provider, exporter = otel_in_memory
216215
monkeypatch.setenv("GOOGLE_SDK_EXPERIMENTAL_PYTHON_TRACING_ENABLED", "true")
217216

218-
otel_wrapper = _observability.get_otel_channel_wrapper(
217+
otel_interceptor = _observability.get_otel_interceptor(
219218
{"tracer_provider": provider}
220219
)
221-
assert otel_wrapper is not None
220+
assert otel_interceptor is not None
222221

223222
custom_channel = grpc.insecure_channel(fake_grpc_server)
224223
transport = SecretManagerServiceGrpcTransport(
225224
channel=custom_channel,
226-
wrappers=[otel_wrapper],
225+
interceptors=[otel_interceptor],
227226
)
228227
client = SecretManagerServiceClient(
229228
transport=transport,
@@ -235,15 +234,15 @@ def test_otel_tracing_custom_channel_with_wrappers(
235234
pass
236235

237236
spans = exporter.get_finished_spans()
238-
assert len(spans) > 0, "No spans recorded on custom channel with OTel wrapper!"
237+
assert len(spans) > 0, "No spans recorded on custom channel with OTel interceptor!"
239238

240239

241-
def test_custom_interceptors_and_wrappers_execution(
240+
def test_custom_interceptors_execution(
242241
fake_grpc_server,
243242
insecure_channel_patch,
244243
):
245244
"""Verify that SecretManagerServiceGrpcTransport executes both gRPC ClientInterceptor instances
246-
and Callable[[Channel], Channel] wrappers on real RPC calls to a local server.
245+
and Callable[[Channel], Channel] interceptor callables on real RPC calls to a local server.
247246
"""
248247
execution_order = []
249248

@@ -252,14 +251,14 @@ def intercept_unary_unary(self, continuation, client_call_details, request):
252251
execution_order.append("interceptor")
253252
return continuation(client_call_details, request)
254253

255-
def tracking_wrapper(ch: grpc.Channel) -> grpc.Channel:
256-
execution_order.append("wrapper")
254+
def tracking_callable(ch: grpc.Channel) -> grpc.Channel:
255+
execution_order.append("callable")
257256
return ch
258257

259258
interceptor = TrackingInterceptor()
260259
transport = SecretManagerServiceGrpcTransport(
261260
host=fake_grpc_server,
262-
wrappers=[interceptor, tracking_wrapper],
261+
interceptors=[interceptor, tracking_callable],
263262
credentials=AnonymousCredentials(),
264263
)
265264
client = SecretManagerServiceClient(
@@ -271,7 +270,7 @@ def tracking_wrapper(ch: grpc.Channel) -> grpc.Channel:
271270
except Exception:
272271
pass
273272

274-
assert "wrapper" in execution_order
273+
assert "callable" in execution_order
275274
assert "interceptor" in execution_order
276275

277276

0 commit comments

Comments
 (0)