Merge pull request #9045 from nathanielmanistaatgoogle/interop-fixes-v1.0.x

Interop fixes.
pull/9094/head
Nathaniel Manista 8 years ago committed by GitHub
commit d0e336ab58
  1. 22
      src/python/grpcio_tests/tests/interop/methods.py

@ -33,7 +33,6 @@ import enum
import json import json
import os import os
import threading import threading
import time
from oauth2client import client as oauth2client_client from oauth2client import client as oauth2client_client
@ -159,16 +158,6 @@ def _server_streaming(stub):
raise ValueError( raise ValueError(
'response body of invalid size %d!' % len(response.payload.body)) 'response body of invalid size %d!' % len(response.payload.body))
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): class _Pipe(object):
@ -232,6 +221,16 @@ def _ping_pong(stub):
'response body of invalid size %d!' % len(response.payload.body)) 'response body of invalid size %d!' % len(response.payload.body))
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): def _cancel_after_first_response(stub):
request_response_sizes = (31415, 9, 2653, 58979,) request_response_sizes = (31415, 9, 2653, 58979,)
request_payload_sizes = (27182, 8, 1828, 45904,) request_payload_sizes = (27182, 8, 1828, 45904,)
@ -269,7 +268,6 @@ def _timeout_on_sleeping_server(stub):
response_type=messages_pb2.COMPRESSABLE, response_type=messages_pb2.COMPRESSABLE,
payload=messages_pb2.Payload(body=b'\x00' * request_payload_size)) payload=messages_pb2.Payload(body=b'\x00' * request_payload_size))
pipe.add(request) pipe.add(request)
time.sleep(0.1)
try: try:
next(response_iterator) next(response_iterator)
except grpc.RpcError as rpc_error: except grpc.RpcError as rpc_error:

Loading…
Cancel
Save