Add test for stream unary close channel, remove irrelevant code

pull/21819/head
Pau Freixes 5 years ago
parent 2f81f3df82
commit 46804d8125
  1. 15
      src/python/grpcio_tests/tests_aio/unit/close_channel_test.py

@ -81,7 +81,6 @@ class TestCloseChannel(AioTestBase):
) )
call = UnaryCallWithSleep(messages_pb2.SimpleRequest()) call = UnaryCallWithSleep(messages_pb2.SimpleRequest())
task = asyncio.ensure_future(call)
await channel.close(grace=UNARY_CALL_WITH_SLEEP_VALUE * 2) await channel.close(grace=UNARY_CALL_WITH_SLEEP_VALUE * 2)
@ -96,7 +95,6 @@ class TestCloseChannel(AioTestBase):
) )
call = UnaryCallWithSleep(messages_pb2.SimpleRequest()) call = UnaryCallWithSleep(messages_pb2.SimpleRequest())
task = asyncio.ensure_future(call)
await channel.close(None) await channel.close(None)
@ -133,6 +131,19 @@ class TestCloseChannel(AioTestBase):
self.assertEqual(channel._ongoing_calls.size(), 0) self.assertEqual(channel._ongoing_calls.size(), 0)
async def test_close_stream_unary(self):
channel = aio.insecure_channel(self._server_target)
stub = test_pb2_grpc.TestServiceStub(channel)
calls = [stub.StreamingInputCall() for _ in range(2)]
await channel.close()
for call in calls:
self.assertTrue(call.cancelled())
self.assertEqual(channel._ongoing_calls.size(), 0)
async def test_close_stream_stream(self): async def test_close_stream_stream(self):
channel = aio.insecure_channel(self._server_target) channel = aio.insecure_channel(self._server_target)
stub = test_pb2_grpc.TestServiceStub(channel) stub = test_pb2_grpc.TestServiceStub(channel)

Loading…
Cancel
Save