Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interops test proto to match grpc-java. #41

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ proto_library(
visibility = ["//visibility:public"],
)

proto_library(
name = "test_proto",
srcs = ["grpc/testing/test.proto"],
visibility = ["//visibility:public"],
deps = [
":empty_proto",
":messages_proto",
],
)

proto_library(
name = "empty_proto",
srcs = ["grpc/testing/empty.proto"],
visibility = ["//visibility:public"],
)

# Deprecated: do not use
proto_library(
name = "reflection_proto_deprecated",
Expand Down
29 changes: 29 additions & 0 deletions grpc/testing/empty.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2015 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto2";

package grpc.testing;

option java_package = "io.grpc.testing.integration";
option java_outer_classname = "EmptyProtos";

// An empty message that you can re-use to avoid defining duplicated empty
// messages in your project. A typical example is to use it as argument or the
// return value of a service API. For instance:
//
// service Foo {
// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
// };
//
message Empty {}
26 changes: 10 additions & 16 deletions grpc/testing/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ syntax = "proto3";

package grpc.testing;

option java_package = "io.grpc.testing.integration";

// TODO(dgq): Go back to using well-known types once
// https://github.com/grpc/grpc/issues/6980 has been fixed.
// import "google/protobuf/wrappers.proto";
Expand All @@ -27,16 +29,10 @@ message BoolValue {
bool value = 1;
}

// The type of payload that should be returned.
enum PayloadType {
// Compressable text format.
COMPRESSABLE = 0;
}

// A block of data, to simply increase gRPC message size.
message Payload {
// The type of data in body.
PayloadType type = 1;
reserved 1;

// Primary contents of payload.
bytes body = 2;
}
Expand All @@ -50,9 +46,7 @@ message EchoStatus {

// Unary request.
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
PayloadType response_type = 1;
reserved 1;

// Desired payload size in the response from the server.
int32 response_size = 2;
Expand Down Expand Up @@ -90,6 +84,10 @@ message SimpleResponse {
string oauth_scope = 3;
}

message SimpleContext {
string value = 1;
}

// Client-streaming request.
message StreamingInputCallRequest {
// Optional input payload sent along with the request.
Expand Down Expand Up @@ -128,11 +126,7 @@ message ResponseParameters {

// Server-streaming request.
message StreamingOutputCallRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
PayloadType response_type = 1;
reserved 1;

// Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2;
Expand Down
81 changes: 81 additions & 0 deletions grpc/testing/test.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright 2018 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
syntax = "proto3";

import "grpc/testing/empty.proto";
import "grpc/testing/messages.proto";

package grpc.testing;

option java_package = "io.grpc.testing.integration";

// A simple service to test the various types of RPCs and experiment with
// performance with various types of payload.
service TestService {
// One empty request followed by one empty response.
rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty);

// One request followed by one response.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);

// One request followed by one response. Response has cache control
// headers set such that a caching HTTP proxy (such as GFE) can
// satisfy subsequent requests.
rpc CacheableUnaryCall(SimpleRequest) returns (SimpleResponse);

// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
rpc StreamingOutputCall(StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);

// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
rpc StreamingInputCall(stream StreamingInputCallRequest)
returns (StreamingInputCallResponse);

// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
rpc FullDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);

// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);

// The test server will not implement this method. It will be used
// to test the behavior when clients call unimplemented methods.
rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
}

// A simple service NOT implemented at servers so clients can test for
// that case.
service UnimplementedService {
// A call that no server should implement
rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
}

// A service used to control reconnect server.
service ReconnectService {
// Starts ReconnectService
rpc Start(grpc.testing.Empty) returns (grpc.testing.Empty);

// Stops ReconnectService
rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo);
}