diff options
Diffstat (limited to 'src/python/grpcio_tests/tests/interop')
-rw-r--r-- | src/python/grpcio_tests/tests/interop/client.py | 8 | ||||
-rw-r--r-- | src/python/grpcio_tests/tests/interop/methods.py | 22 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/python/grpcio_tests/tests/interop/client.py b/src/python/grpcio_tests/tests/interop/client.py index 4fbf58f7d9..afaa466254 100644 --- a/src/python/grpcio_tests/tests/interop/client.py +++ b/src/python/grpcio_tests/tests/interop/client.py @@ -43,11 +43,13 @@ from tests.interop import resources def _args(): parser = argparse.ArgumentParser() parser.add_argument( - '--server_host', help='the host to which to connect', type=str) + '--server_host', help='the host to which to connect', type=str, + default="127.0.0.1") parser.add_argument( '--server_port', help='the port to which to connect', type=int) parser.add_argument( - '--test_case', help='the test case to execute', type=str) + '--test_case', help='the test case to execute', type=str, + default="large_unary") parser.add_argument( '--use_tls', help='require a secure connection', default=False, type=resources.parse_bool) @@ -55,7 +57,7 @@ def _args(): '--use_test_ca', help='replace platform root CAs with ca.pem', default=False, type=resources.parse_bool) parser.add_argument( - '--server_host_override', + '--server_host_override', default="foo.test.google.fr", help='the server host to which to claim to connect', type=str) parser.add_argument('--oauth_scope', help='scope for OAuth tokens', type=str) parser.add_argument( diff --git a/src/python/grpcio_tests/tests/interop/methods.py b/src/python/grpcio_tests/tests/interop/methods.py index 52e56f3502..9038ae5751 100644 --- a/src/python/grpcio_tests/tests/interop/methods.py +++ b/src/python/grpcio_tests/tests/interop/methods.py @@ -33,7 +33,6 @@ import enum import json import os import threading -import time from oauth2client import client as oauth2client_client @@ -196,16 +195,6 @@ def _server_streaming(stub): response, messages_pb2.COMPRESSABLE, sizes[index]) -def _cancel_after_begin(stub): - sizes = (27182, 8, 1828, 45904,) - payloads = (messages_pb2.Payload(body=b'\x00' * size) for size in sizes) - requests = (messages_pb2.StreamingInputCallRequest(payload=payload) - for payload in payloads) - response_future = stub.StreamingInputCall.future(requests) - response_future.cancel() - if not response_future.cancelled(): - raise ValueError('expected call to be cancelled') - class _Pipe(object): @@ -265,6 +254,16 @@ def _ping_pong(stub): response, messages_pb2.COMPRESSABLE, response_size) +def _cancel_after_begin(stub): + with _Pipe() as pipe: + response_future = stub.StreamingInputCall.future(pipe) + response_future.cancel() + if not response_future.cancelled(): + raise ValueError('expected cancelled method to return True') + if response_future.code() is not grpc.StatusCode.CANCELLED: + raise ValueError('expected status code CANCELLED') + + def _cancel_after_first_response(stub): request_response_sizes = (31415, 9, 2653, 58979,) request_payload_sizes = (27182, 8, 1828, 45904,) @@ -302,7 +301,6 @@ def _timeout_on_sleeping_server(stub): response_type=messages_pb2.COMPRESSABLE, payload=messages_pb2.Payload(body=b'\x00' * request_payload_size)) pipe.add(request) - time.sleep(0.1) try: next(response_iterator) except grpc.RpcError as rpc_error: |