def unary_unary(self, request, context): with self._lock: self._received_client_metadata = context.invocation_metadata() context.send_initial_metadata(_SERVER_INITIAL_METADATA) context.set_trailing_metadata(_SERVER_TRAILING_METADATA) if self._code is not None: context.set_code(self._code) if self._details is not None: context.set_details(self._details) if self._exception: raise test_control.Defect() else: return None if self._return_none else object()
def unary_stream(self, request, context): with self._lock: self._received_client_metadata = context.invocation_metadata() context.send_initial_metadata(_SERVER_INITIAL_METADATA) context.set_trailing_metadata(_SERVER_TRAILING_METADATA) if self._code is not None: context.set_code(self._code) if self._details is not None: context.set_details(self._details) for _ in range(test_constants.STREAM_LENGTH // 2): yield _SERIALIZED_RESPONSE if self._exception: raise test_control.Defect()
def stream_stream(self, request_iterator, context): with self._lock: self._received_client_metadata = context.invocation_metadata() context.send_initial_metadata(_SERVER_INITIAL_METADATA) context.set_trailing_metadata(_SERVER_TRAILING_METADATA) if self._abort_call: context.abort(self._code, self._details) else: if self._code is not None: context.set_code(self._code) if self._details is not None: context.set_details(self._details) for _ in range(test_constants.STREAM_LENGTH // 3): yield object() if self._exception: raise test_control.Defect()
def stream_unary(self, request_iterator, context): with self._lock: self._received_client_metadata = context.invocation_metadata() context.send_initial_metadata(_SERVER_INITIAL_METADATA) context.set_trailing_metadata(_SERVER_TRAILING_METADATA) if self._abort_call: context.abort(self._code, self._details) else: if self._code is not None: context.set_code(self._code) if self._details is not None: context.set_details(self._details) if self._exception: raise test_control.Defect() else: return None if self._return_none else _SERIALIZED_RESPONSE
def stream_stream(self, request_iterator, context): with self._lock: self._received_client_metadata = context.invocation_metadata() context.send_initial_metadata(_SERVER_INITIAL_METADATA) context.set_trailing_metadata(_SERVER_TRAILING_METADATA) if self._code is not None: context.set_code(self._code) if self._details is not None: context.set_details(self._details) # TODO(https://github.com/grpc/grpc/issues/6891): just ignore the # request iterator. for ignored_request in request_iterator: pass for _ in range(test_constants.STREAM_LENGTH // 3): yield object() if self._exception: raise test_control.Defect()
def stream_unary(self, request_iterator, context): with self._lock: self._received_client_metadata = context.invocation_metadata() context.send_initial_metadata(_SERVER_INITIAL_METADATA) context.set_trailing_metadata(_SERVER_TRAILING_METADATA) if self._code is not None: context.set_code(self._code) if self._details is not None: context.set_details(self._details) # TODO(https://github.com/grpc/grpc/issues/6891): just ignore the # request iterator. for ignored_request in request_iterator: pass if self._exception: raise test_control.Defect() else: return None if self._return_none else _SERIALIZED_RESPONSE
def defective_generic_rpc_handler(self): raise test_control.Defect()
def __next__(self): if self._current >= self._high: raise test_control.Defect() else: self._current += 1 return self._bytestring
def intercept_unary_unary(self, ignored_continuation, ignored_client_call_details, ignored_request): raise test_control.Defect()