Merge pull request #10174 from nathanielmanistaatgoogle/health

Update health to current gRPC code elements.
pull/6854/head
Nathaniel Manista 8 years ago committed by GitHub
commit 6b2662adf5
  1. 3
      src/python/grpcio_health_checking/grpc_health/v1/health.py
  2. 5
      src/python/grpcio_tests/tests/health_check/_health_servicer_test.py

@ -33,9 +33,10 @@ import threading
import grpc import grpc
from grpc_health.v1 import health_pb2 from grpc_health.v1 import health_pb2
from grpc_health.v1 import health_pb2_grpc
class HealthServicer(health_pb2.HealthServicer): class HealthServicer(health_pb2_grpc.HealthServicer):
"""Servicer handling RPCs for service statuses.""" """Servicer handling RPCs for service statuses."""
def __init__(self): def __init__(self):

@ -34,6 +34,7 @@ import grpc
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
from grpc_health.v1 import health from grpc_health.v1 import health
from grpc_health.v1 import health_pb2 from grpc_health.v1 import health_pb2
from grpc_health.v1 import health_pb2_grpc
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
@ -52,11 +53,11 @@ class HealthServicerTest(unittest.TestCase):
server_pool = logging_pool.pool(test_constants.THREAD_CONCURRENCY) server_pool = logging_pool.pool(test_constants.THREAD_CONCURRENCY)
self._server = grpc.server(server_pool) self._server = grpc.server(server_pool)
port = self._server.add_insecure_port('[::]:0') port = self._server.add_insecure_port('[::]:0')
health_pb2.add_HealthServicer_to_server(servicer, self._server) health_pb2_grpc.add_HealthServicer_to_server(servicer, self._server)
self._server.start() self._server.start()
channel = grpc.insecure_channel('localhost:%d' % port) channel = grpc.insecure_channel('localhost:%d' % port)
self._stub = health_pb2.HealthStub(channel) self._stub = health_pb2_grpc.HealthStub(channel)
def test_empty_service(self): def test_empty_service(self):
request = health_pb2.HealthCheckRequest() request = health_pb2.HealthCheckRequest()

Loading…
Cancel
Save