77 _testsuite_client_config: client.TestsuiteClientConfig,
78) -> Callable[[grpc.aio.ClientCallDetails], Awaitable[
None]]:
80 Returns the function that will be called in before each gRPC request,
83 @ingroup userver_testsuite_fixtures
87 _client_call_details: grpc.aio.ClientCallDetails,
90 if isinstance(service_client, client.AiohttpClient):
91 await service_client.update_server_state()
96@pytest.fixture(scope='session')
110 grpc_service_endpoint,
112 grpc_service_timeout,
113 grpc_session_channel,
114 _grpc_channel_interceptor,
118 Returns the gRPC channel configured by the parameters from the
119 @ref plugins.grpc.grpc_service_endpoint "grpc_service_endpoint" fixture.
121 @ingroup userver_testsuite_fixtures
123 _grpc_channel_interceptor.prepare_func = grpc_client_prepare
125 await asyncio.wait_for(
126 grpc_session_channel.channel_ready(),
127 timeout=grpc_service_timeout,
129 except asyncio.TimeoutError:
131 f
'Failed to connect to remote gRPC server by ' f
'address {grpc_service_endpoint}',
133 return grpc_session_channel
166 grpc.aio.UnaryUnaryClientInterceptor,
167 grpc.aio.UnaryStreamClientInterceptor,
168 grpc.aio.StreamUnaryClientInterceptor,
169 grpc.aio.StreamStreamClientInterceptor,
172 self.prepare_func: Optional[Callable[[grpc.aio.ClientCallDetails], Awaitable[
None]]] =
None
174 async def intercept_unary_unary(
180 await self.prepare_func(client_call_details)
181 return await continuation(client_call_details, request)
183 async def intercept_unary_stream(
189 await self.prepare_func(client_call_details)
190 return await continuation(client_call_details, next(request))
192 async def intercept_stream_unary(
198 await self.prepare_func(client_call_details)
199 return await continuation(client_call_details, request_iterator)
201 async def intercept_stream_stream(
207 await self.prepare_func(client_call_details)
208 return await continuation(client_call_details, request_iterator)
211@pytest.fixture(scope='session')