Fix the windows failure

pull/21803/head
Lidi Zheng 5 years ago
parent 4e4f1f40f1
commit 1b92dc0a7e
  1. 2
      src/python/grpcio_tests/tests_aio/unit/_common.py
  2. 11
      src/python/grpcio_tests/tests_aio/unit/wait_for_ready_test.py

@ -30,7 +30,5 @@ async def block_until_certain_state(channel: aio.Channel,
expected_state: grpc.ChannelConnectivity): expected_state: grpc.ChannelConnectivity):
state = channel.get_state() state = channel.get_state()
while state != expected_state: while state != expected_state:
import logging
logging.debug('Get %s want %s', state, expected_state)
await channel.wait_for_state_change(state) await channel.wait_for_state_change(state)
state = channel.get_state() state = channel.get_state()

@ -35,7 +35,7 @@ _RESPONSE_PAYLOAD_SIZE = 42
async def _perform_unary_unary(stub, wait_for_ready): async def _perform_unary_unary(stub, wait_for_ready):
await stub.UnaryCall(messages_pb2.SimpleRequest(), await stub.UnaryCall(messages_pb2.SimpleRequest(),
timeout=test_constants.SHORT_TIMEOUT, timeout=test_constants.LONG_TIMEOUT,
wait_for_ready=wait_for_ready) wait_for_ready=wait_for_ready)
@ -46,7 +46,7 @@ async def _perform_unary_stream(stub, wait_for_ready):
messages_pb2.ResponseParameters(size=_RESPONSE_PAYLOAD_SIZE)) messages_pb2.ResponseParameters(size=_RESPONSE_PAYLOAD_SIZE))
call = stub.StreamingOutputCall(request, call = stub.StreamingOutputCall(request,
timeout=test_constants.SHORT_TIMEOUT, timeout=test_constants.LONG_TIMEOUT,
wait_for_ready=wait_for_ready) wait_for_ready=wait_for_ready)
for _ in range(_NUM_STREAM_RESPONSES): for _ in range(_NUM_STREAM_RESPONSES):
@ -63,12 +63,12 @@ async def _perform_stream_unary(stub, wait_for_ready):
yield request yield request
await stub.StreamingInputCall(gen(), await stub.StreamingInputCall(gen(),
timeout=test_constants.SHORT_TIMEOUT, timeout=test_constants.LONG_TIMEOUT,
wait_for_ready=wait_for_ready) wait_for_ready=wait_for_ready)
async def _perform_stream_stream(stub, wait_for_ready): async def _perform_stream_stream(stub, wait_for_ready):
call = stub.FullDuplexCall(timeout=test_constants.SHORT_TIMEOUT, call = stub.FullDuplexCall(timeout=test_constants.LONG_TIMEOUT,
wait_for_ready=wait_for_ready) wait_for_ready=wait_for_ready)
request = messages_pb2.StreamingOutputCallRequest() request = messages_pb2.StreamingOutputCallRequest()
@ -112,12 +112,15 @@ class TestWaitForReady(AioTestBase):
self.assertEqual(grpc.StatusCode.UNAVAILABLE, rpc_error.code()) self.assertEqual(grpc.StatusCode.UNAVAILABLE, rpc_error.code())
async def test_call_wait_for_ready_default(self): async def test_call_wait_for_ready_default(self):
"""RPC should fail immediately after connection failed."""
await self._connection_fails_fast(None) await self._connection_fails_fast(None)
async def test_call_wait_for_ready_disabled(self): async def test_call_wait_for_ready_disabled(self):
"""RPC should fail immediately after connection failed."""
await self._connection_fails_fast(False) await self._connection_fails_fast(False)
async def test_call_wait_for_ready_enabled(self): async def test_call_wait_for_ready_enabled(self):
"""RPC will wait until the connection is ready."""
for action in _RPC_ACTIONS: for action in _RPC_ACTIONS:
with self.subTest(name=action.__name__): with self.subTest(name=action.__name__):
# Starts the RPC # Starts the RPC

Loading…
Cancel
Save