Skip to content

Commit 5f94457

Browse files
committed
Add test.proto which is used in interops test in various gRPC projects.
The test.proto is adapted from grpc-java.
1 parent f9af5e1 commit 5f94457

File tree

3 files changed

+109
-11
lines changed

3 files changed

+109
-11
lines changed

BUILD.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ proto_library(
2424
proto_library(
2525
name = "messages_proto",
2626
srcs = ["grpc/testing/messages.proto"],
27+
deps = ["@com_google_protobuf//:wrappers_proto"],
2728
)
2829

2930
proto_library(
@@ -111,6 +112,16 @@ proto_library(
111112
visibility = ["//visibility:public"],
112113
)
113114

115+
proto_library(
116+
name = "test_proto",
117+
srcs = ["grpc/testing/test.proto"],
118+
visibility = ["//visibility:public"],
119+
deps = [
120+
":messages_proto",
121+
"@com_google_protobuf//:empty_proto",
122+
],
123+
)
124+
114125
# Deprecated: do not use
115126
proto_library(
116127
name = "reflection_proto_deprecated",

grpc/testing/messages.proto

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ syntax = "proto3";
1919

2020
package grpc.testing;
2121

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-
}
22+
option java_package = "io.grpc.testing.integration";
23+
24+
import "google/protobuf/wrappers.proto";
2925

3026
// The type of payload that should be returned.
3127
enum PayloadType {
3228
// Compressable text format.
3329
COMPRESSABLE = 0;
30+
31+
// Uncompressable binary format.
32+
UNCOMPRESSABLE = 1;
33+
34+
// Randomly chosen from all other formats defined in this enum.
35+
RANDOM = 2;
3436
}
3537

3638
// A block of data, to simply increase gRPC message size.
@@ -70,13 +72,13 @@ message SimpleRequest {
7072
// "nullable" in order to interoperate seamlessly with clients not able to
7173
// implement the full compression tests by introspecting the call to verify
7274
// the response's compression status.
73-
BoolValue response_compressed = 6;
75+
google.protobuf.BoolValue response_compressed = 6;
7476

7577
// Whether server should return a given status
7678
EchoStatus response_status = 7;
7779

7880
// Whether the server should expect this request to be compressed.
79-
BoolValue expect_compressed = 8;
81+
google.protobuf.BoolValue expect_compressed = 8;
8082
}
8183

8284
// Unary response, as configured by the request.
@@ -90,6 +92,10 @@ message SimpleResponse {
9092
string oauth_scope = 3;
9193
}
9294

95+
message SimpleContext {
96+
string value = 1;
97+
}
98+
9399
// Client-streaming request.
94100
message StreamingInputCallRequest {
95101
// Optional input payload sent along with the request.
@@ -99,7 +105,7 @@ message StreamingInputCallRequest {
99105
// is "nullable" in order to interoperate seamlessly with servers not able to
100106
// implement the full compression tests by introspecting the call to verify
101107
// the request's compression status.
102-
BoolValue expect_compressed = 2;
108+
google.protobuf.BoolValue expect_compressed = 2;
103109

104110
// Not expecting any payload from the response.
105111
}
@@ -123,7 +129,7 @@ message ResponseParameters {
123129
// "nullable" in order to interoperate seamlessly with clients not able to
124130
// implement the full compression tests by introspecting the call to verify
125131
// the response's compression status.
126-
BoolValue compressed = 3;
132+
google.protobuf.BoolValue compressed = 3;
127133
}
128134

129135
// Server-streaming request.

grpc/testing/test.proto

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright 2018 The gRPC Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
// An integration test service that covers all the method signature permutations
15+
// of unary/streaming requests/responses.
16+
syntax = "proto3";
17+
18+
import "google/protobuf/empty.proto";
19+
import "grpc/testing/messages.proto";
20+
21+
package grpc.testing;
22+
23+
option java_package = "io.grpc.testing.integration";
24+
25+
// A simple service to test the various types of RPCs and experiment with
26+
// performance with various types of payload.
27+
service TestService {
28+
// One empty request followed by one empty response.
29+
rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty);
30+
31+
// One request followed by one response.
32+
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
33+
34+
// One request followed by one response. Response has cache control
35+
// headers set such that a caching HTTP proxy (such as GFE) can
36+
// satisfy subsequent requests.
37+
rpc CacheableUnaryCall(SimpleRequest) returns (SimpleResponse);
38+
39+
// One request followed by a sequence of responses (streamed download).
40+
// The server returns the payload with client desired type and sizes.
41+
rpc StreamingOutputCall(StreamingOutputCallRequest)
42+
returns (stream StreamingOutputCallResponse);
43+
44+
// A sequence of requests followed by one response (streamed upload).
45+
// The server returns the aggregated size of client payload as the result.
46+
rpc StreamingInputCall(stream StreamingInputCallRequest)
47+
returns (StreamingInputCallResponse);
48+
49+
// A sequence of requests with each request served by the server immediately.
50+
// As one request could lead to multiple responses, this interface
51+
// demonstrates the idea of full duplexing.
52+
rpc FullDuplexCall(stream StreamingOutputCallRequest)
53+
returns (stream StreamingOutputCallResponse);
54+
55+
// A sequence of requests followed by a sequence of responses.
56+
// The server buffers all the client requests and then serves them in order. A
57+
// stream of responses are returned to the client when the server starts with
58+
// first request.
59+
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
60+
returns (stream StreamingOutputCallResponse);
61+
62+
// The test server will not implement this method. It will be used
63+
// to test the behavior when clients call unimplemented methods.
64+
rpc UnimplementedCall(google.protobuf.Empty) returns (google.protobuf.Empty);
65+
}
66+
67+
// A simple service NOT implemented at servers so clients can test for
68+
// that case.
69+
service UnimplementedService {
70+
// A call that no server should implement
71+
rpc UnimplementedCall(google.protobuf.Empty) returns (google.protobuf.Empty);
72+
}
73+
74+
// A service used to control reconnect server.
75+
service ReconnectService {
76+
// Starts ReconnectService
77+
rpc Start(google.protobuf.Empty) returns (google.protobuf.Empty);
78+
79+
// Stops ReconnectService
80+
rpc Stop(google.protobuf.Empty) returns (grpc.testing.ReconnectInfo);
81+
}

0 commit comments

Comments
 (0)