def test_grpc_server_msg_sent_with_unary_stream(number_of_res, grpc_server,
                                                grpc_stub):  # pylint: disable=unused-argument
    list(
        grpc_stub.SayHelloUnaryStream(
            hello_world_pb2.MultipleHelloResRequest(name="unary stream",
                                                    res=number_of_res)))
    target_metric = get_server_metric("grpc_server_msg_sent")
    assert target_metric.samples[0].value == number_of_res
def test_legacy_grpc_server_handled_latency_seconds_with_unary_stream(
    number_of_res, grpc_legacy_server, grpc_stub
):  # pylint: disable=unused-argument
  list(
      grpc_stub.SayHelloUnaryStream(
          hello_world_pb2.MultipleHelloResRequest(
              name="unary stream", res=number_of_res
          )
      )
  )
  target_metric = get_server_metric("grpc_server_handled_latency_seconds")
  # No grpc_server_handled_latency_seconds for streaming response
  assert target_metric.samples == []
def test_grpc_server_handling_seconds_with_unary_stream(
    number_of_res, grpc_server, grpc_stub
):  # pylint: disable=unused-argument
  list(
      grpc_stub.SayHelloUnaryStream(
          hello_world_pb2.MultipleHelloResRequest(
              name="unary stream", res=number_of_res
          )
      )
  )
  target_metric = get_server_metric("grpc_server_handling_seconds")
  # Only one request sent
  assert target_metric.samples == []
Пример #4
0
 def _generate_bidi_requests(number_of_names, number_of_res):
   for i in range(number_of_names):
     yield hello_world_pb2.MultipleHelloResRequest(name="{}".format(i), res=number_of_res)