pull/18095/head
Eric Gribkoff 6 years ago
parent 77f325a9af
commit 003212648f
  1. 2
      src/python/grpcio_tests/tests/health_check/_health_servicer_test.py
  2. 16
      src/python/grpcio_tests/tests/unit/_channel_connectivity_test.py
  3. 8
      src/python/grpcio_tests/tests/unit/_channel_ready_future_test.py

@ -206,7 +206,7 @@ class BaseWatchTests(object):
class HealthServicerTest(BaseWatchTests.WatchTests):
def setUp(self):
self._thread_pool = _thread_pool.RecordingThreadPool(max_workers=None)
self._thread_pool = thread_pool.RecordingThreadPool(max_workers=None)
super(HealthServicerTest, self).start_server(
non_blocking=True, thread_pool=self._thread_pool)

@ -85,8 +85,10 @@ class ChannelConnectivityTest(unittest.TestCase):
self.assertNotIn(grpc.ChannelConnectivity.READY, fifth_connectivities)
def test_immediately_connectable_channel_connectivity(self):
thread_pool = _thread_pool.RecordingThreadPool(max_workers=None)
server = grpc.server(thread_pool, options=(('grpc.so_reuseport', 0),))
recording_thread_pool = thread_pool.RecordingThreadPool(
max_workers=None)
server = grpc.server(
recording_thread_pool, options=(('grpc.so_reuseport', 0),))
port = server.add_insecure_port('[::]:0')
server.start()
first_callback = _Callback()
@ -125,11 +127,13 @@ class ChannelConnectivityTest(unittest.TestCase):
fourth_connectivities)
self.assertNotIn(grpc.ChannelConnectivity.SHUTDOWN,
fourth_connectivities)
self.assertFalse(thread_pool.was_used())
self.assertFalse(recording_thread_pool.was_used())
def test_reachable_then_unreachable_channel_connectivity(self):
thread_pool = _thread_pool.RecordingThreadPool(max_workers=None)
server = grpc.server(thread_pool, options=(('grpc.so_reuseport', 0),))
recording_thread_pool = thread_pool.RecordingThreadPool(
max_workers=None)
server = grpc.server(
recording_thread_pool, options=(('grpc.so_reuseport', 0),))
port = server.add_insecure_port('[::]:0')
server.start()
callback = _Callback()
@ -143,7 +147,7 @@ class ChannelConnectivityTest(unittest.TestCase):
_last_connectivity_is_not_ready)
channel.unsubscribe(callback.update)
channel.close()
self.assertFalse(thread_pool.was_used())
self.assertFalse(recording_thread_pool.was_used())
if __name__ == '__main__':

@ -63,8 +63,10 @@ class ChannelReadyFutureTest(unittest.TestCase):
channel.close()
def test_immediately_connectable_channel_connectivity(self):
thread_pool = _thread_pool.RecordingThreadPool(max_workers=None)
server = grpc.server(thread_pool, options=(('grpc.so_reuseport', 0),))
recording_thread_pool = thread_pool.RecordingThreadPool(
max_workers=None)
server = grpc.server(
recording_thread_pool, options=(('grpc.so_reuseport', 0),))
port = server.add_insecure_port('[::]:0')
server.start()
channel = grpc.insecure_channel('localhost:{}'.format(port))
@ -84,7 +86,7 @@ class ChannelReadyFutureTest(unittest.TestCase):
self.assertFalse(ready_future.cancelled())
self.assertTrue(ready_future.done())
self.assertFalse(ready_future.running())
self.assertFalse(thread_pool.was_used())
self.assertFalse(recording_thread_pool.was_used())
channel.close()
server.stop(None)

Loading…
Cancel
Save