|
57 | 57 | typed_flaky = cast(Callable[[C], C], flaky(max_runs=5, min_passes=1)) |
58 | 58 |
|
59 | 59 |
|
60 | | -# NOTE: This interceptor is required to create an intercept channel. |
61 | | -class _PublisherClientGrpcInterceptor( |
62 | | - grpc.UnaryUnaryClientInterceptor, |
63 | | -): |
64 | | - def intercept_unary_unary(self, continuation, client_call_details, request): |
65 | | - pass |
66 | | - |
67 | | - |
68 | 60 | def _assert_retries_equal(retry, retry2): |
69 | 61 | # Retry instances cannot be directly compared, because their predicates are |
70 | 62 | # different instances of the same function. We thus manually compare their other |
@@ -424,27 +416,17 @@ def init(self, *args, **kwargs): |
424 | 416 | assert client.transport._ssl_channel_credentials == mock_ssl_creds |
425 | 417 |
|
426 | 418 |
|
427 | | -def test_init_emulator(monkeypatch, creds): |
| 419 | +def test_init_emulator(monkeypatch): |
428 | 420 | monkeypatch.setenv("PUBSUB_EMULATOR_HOST", "/foo/bar:123") |
429 | 421 | # NOTE: When the emulator host is set, a custom channel will be used, so |
430 | 422 | # no credentials (mock ot otherwise) can be passed in. |
431 | | - |
432 | | - # TODO(https://github.com/grpc/grpc/issues/38519): Workaround to create an intercept |
433 | | - # channel (for forwards compatibility) with a channel created by the publisher client |
434 | | - # where target is set to the emulator host. |
435 | | - channel = publisher.Client().transport.grpc_channel |
436 | | - interceptor = _PublisherClientGrpcInterceptor() |
437 | | - intercept_channel = grpc.intercept_channel(channel, interceptor) |
438 | | - transport = publisher.Client.get_transport_class("grpc")( |
439 | | - credentials=creds, channel=intercept_channel |
440 | | - ) |
441 | | - client = publisher.Client(transport=transport) |
| 423 | + client = publisher.Client() |
442 | 424 |
|
443 | 425 | # Establish that a gRPC request would attempt to hit the emulator host. |
444 | 426 | # |
445 | 427 | # Sadly, there seems to be no good way to do this without poking at |
446 | 428 | # the private API of gRPC. |
447 | | - channel = client._transport.publish._thunk("")._channel |
| 429 | + channel = client._transport.publish._channel |
448 | 430 | # Behavior to include dns prefix changed in gRPCv1.63 |
449 | 431 | grpc_major, grpc_minor = [int(part) for part in grpc.__version__.split(".")[0:2]] |
450 | 432 | if grpc_major > 1 or (grpc_major == 1 and grpc_minor >= 63): |
|
0 commit comments