Home | History | Annotate | Download | only in testing
      1 
      2 // Copyright 2015-2016 gRPC authors.
      3 //
      4 // Licensed under the Apache License, Version 2.0 (the "License");
      5 // you may not use this file except in compliance with the License.
      6 // You may obtain a copy of the License at
      7 //
      8 //     http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unless required by applicable law or agreed to in writing, software
     11 // distributed under the License is distributed on an "AS IS" BASIS,
     12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 // See the License for the specific language governing permissions and
     14 // limitations under the License.
     15 
     16 // Message definitions to be used by integration test service definitions.
     17 
     18 syntax = "proto3";
     19 
     20 package grpc.testing;
     21 
     22 // TODO(dgq): Go back to using well-known types once
     23 // https://github.com/grpc/grpc/issues/6980 has been fixed.
     24 // import "google/protobuf/wrappers.proto";
     25 message BoolValue {
     26   // The bool value.
     27   bool value = 1;
     28 }
     29 
     30 // The type of payload that should be returned.
     31 enum PayloadType {
     32   // Compressable text format.
     33   COMPRESSABLE = 0;
     34 }
     35 
     36 // A block of data, to simply increase gRPC message size.
     37 message Payload {
     38   // The type of data in body.
     39   PayloadType type = 1;
     40   // Primary contents of payload.
     41   bytes body = 2;
     42 }
     43 
     44 // A protobuf representation for grpc status. This is used by test
     45 // clients to specify a status that the server should attempt to return.
     46 message EchoStatus {
     47   int32 code = 1;
     48   string message = 2;
     49 }
     50 
     51 // Unary request.
     52 message SimpleRequest {
     53   // Desired payload type in the response from the server.
     54   // If response_type is RANDOM, server randomly chooses one from other formats.
     55   PayloadType response_type = 1;
     56 
     57   // Desired payload size in the response from the server.
     58   int32 response_size = 2;
     59 
     60   // Optional input payload sent along with the request.
     61   Payload payload = 3;
     62 
     63   // Whether SimpleResponse should include username.
     64   bool fill_username = 4;
     65 
     66   // Whether SimpleResponse should include OAuth scope.
     67   bool fill_oauth_scope = 5;
     68 
     69   // Whether to request the server to compress the response. This field is
     70   // "nullable" in order to interoperate seamlessly with clients not able to
     71   // implement the full compression tests by introspecting the call to verify
     72   // the response's compression status.
     73   BoolValue response_compressed = 6;
     74 
     75   // Whether server should return a given status
     76   EchoStatus response_status = 7;
     77 
     78   // Whether the server should expect this request to be compressed.
     79   BoolValue expect_compressed = 8;
     80 }
     81 
     82 // Unary response, as configured by the request.
     83 message SimpleResponse {
     84   // Payload to increase message size.
     85   Payload payload = 1;
     86   // The user the request came from, for verifying authentication was
     87   // successful when the client expected it.
     88   string username = 2;
     89   // OAuth scope.
     90   string oauth_scope = 3;
     91 }
     92 
     93 // Client-streaming request.
     94 message StreamingInputCallRequest {
     95   // Optional input payload sent along with the request.
     96   Payload payload = 1;
     97 
     98   // Whether the server should expect this request to be compressed. This field
     99   // is "nullable" in order to interoperate seamlessly with servers not able to
    100   // implement the full compression tests by introspecting the call to verify
    101   // the request's compression status.
    102   BoolValue expect_compressed = 2;
    103 
    104   // Not expecting any payload from the response.
    105 }
    106 
    107 // Client-streaming response.
    108 message StreamingInputCallResponse {
    109   // Aggregated size of payloads received from the client.
    110   int32 aggregated_payload_size = 1;
    111 }
    112 
    113 // Configuration for a particular response.
    114 message ResponseParameters {
    115   // Desired payload sizes in responses from the server.
    116   int32 size = 1;
    117 
    118   // Desired interval between consecutive responses in the response stream in
    119   // microseconds.
    120   int32 interval_us = 2;
    121 
    122   // Whether to request the server to compress the response. This field is
    123   // "nullable" in order to interoperate seamlessly with clients not able to
    124   // implement the full compression tests by introspecting the call to verify
    125   // the response's compression status.
    126   BoolValue compressed = 3;
    127 }
    128 
    129 // Server-streaming request.
    130 message StreamingOutputCallRequest {
    131   // Desired payload type in the response from the server.
    132   // If response_type is RANDOM, the payload from each response in the stream
    133   // might be of different types. This is to simulate a mixed type of payload
    134   // stream.
    135   PayloadType response_type = 1;
    136 
    137   // Configuration for each expected response message.
    138   repeated ResponseParameters response_parameters = 2;
    139 
    140   // Optional input payload sent along with the request.
    141   Payload payload = 3;
    142 
    143   // Whether server should return a given status
    144   EchoStatus response_status = 7;
    145 }
    146 
    147 // Server-streaming response, as configured by the request and parameters.
    148 message StreamingOutputCallResponse {
    149   // Payload to increase response size.
    150   Payload payload = 1;
    151 }
    152 
    153 // For reconnect interop test only.
    154 // Client tells server what reconnection parameters it used.
    155 message ReconnectParams {
    156   int32 max_reconnect_backoff_ms = 1;
    157 }
    158 
    159 // For reconnect interop test only.
    160 // Server tells client whether its reconnects are following the spec and the
    161 // reconnect backoffs it saw.
    162 message ReconnectInfo {
    163   bool passed = 1;
    164   repeated int32 backoff_ms = 2;
    165 }
    166