Fix the test case

pull/21681/head
Lidi Zheng 5 years ago
parent 21670ed1a8
commit 780bff32eb
  1. 11
      src/python/grpcio_tests/tests_aio/unit/call_test.py

@ -382,7 +382,6 @@ class TestUnaryStreamCall(_MulticallableTestMixin, AioTestBase):
request.response_parameters.append(
messages_pb2.ResponseParameters(
size=_RESPONSE_PAYLOAD_SIZE,
interval_us=_INFINITE_INTERVAL_US,
))
# Second message comes back after a unit of wait time
request.response_parameters.append(
@ -397,13 +396,19 @@ class TestUnaryStreamCall(_MulticallableTestMixin, AioTestBase):
response = await call.read()
self.assertEqual(_RESPONSE_PAYLOAD_SIZE, len(response.payload.body))
# Should be around the same as the timeout
remained_time = call.time_remaining()
self.assertGreater(remained_time, test_constants.SHORT_TIMEOUT//2)
self.assertLess(remained_time, test_constants.SHORT_TIMEOUT*3//2)
self.assertGreater(remained_time, test_constants.SHORT_TIMEOUT*3//2)
self.assertLess(remained_time, test_constants.SHORT_TIMEOUT*2)
response = await call.read()
self.assertEqual(_RESPONSE_PAYLOAD_SIZE, len(response.payload.body))
# Should be around the timeout minus a unit of wait time
remained_time = call.time_remaining()
self.assertGreater(remained_time, test_constants.SHORT_TIMEOUT//2)
self.assertLess(remained_time, test_constants.SHORT_TIMEOUT*3//2)
self.assertEqual(grpc.StatusCode.OK, await call.code())
class TestStreamUnaryCall(_MulticallableTestMixin, AioTestBase):

Loading…
Cancel
Save