@@ -770,6 +770,15 @@ def test_secret_manager_service_client_client_options(
770770
771771
772772def test_secret_manager_service_client_otel_channel_injection_enabled():
773+ """Proves that when OpenTelemetry tracing is enabled:
774+
775+ 1. SecretManagerServiceClient detects the feature flag via
776+ _observability.is_otel_capabilities_enabled.
777+ 2. The client eagerly invokes _observability.create_channel_with_otel with
778+ SecretManagerServiceGrpcTransport.create_channel and client configuration.
779+ 3. The eagerly created and wrapped OTel channel is injected into the transport's
780+ constructor kwargs under the 'channel' key.
781+ """
773782 mock_wrapped_channel = mock.Mock()
774783
775784 with (
@@ -802,6 +811,13 @@ def test_secret_manager_service_client_otel_channel_injection_enabled():
802811
803812
804813def test_secret_manager_service_client_otel_channel_injection_disabled():
814+ """Proves that when OpenTelemetry tracing is disabled:
815+
816+ 1. SecretManagerServiceClient checks the feature flag and finds it disabled.
817+ 2. Eager channel creation via _observability.create_channel_with_otel is skipped.
818+ 3. No 'channel' argument is passed to the transport constructor, preserving lazy
819+ channel initialization in the transport.
820+ """
805821 with (
806822 mock.patch(
807823 "google.cloud.secretmanager_v1.services.secret_manager_service.client._observability.is_otel_capabilities_enabled",
@@ -823,6 +839,10 @@ def test_secret_manager_service_client_otel_channel_injection_disabled():
823839
824840
825841def test_secret_manager_service_grpc_transport_interceptors():
842+ """Proves that SecretManagerServiceGrpcTransport accepts custom client interceptors
843+ and invokes grpc_helpers.apply_interceptors to inject them into the underlying
844+ gRPC channel pipeline.
845+ """
826846 mock_interceptor = mock.Mock()
827847 mock_channel = mock.Mock()
828848
0 commit comments