added the unimplemented_call test to interop_client.cc. Next step is to call this from the driver program, run_interop_tests.py

pull/8234/head
Noah Eisen 8 years ago
parent 942c264861
commit a27eb1d07a
  1. 3
      src/proto/grpc/testing/test.proto
  2. 9
      test/cpp/interop/client.cc
  3. 20
      test/cpp/interop/interop_client.cc
  4. 1
      test/cpp/interop/interop_client.h

@ -69,6 +69,9 @@ service TestService {
// first request. // first request.
rpc HalfDuplexCall(stream StreamingOutputCallRequest) rpc HalfDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse); returns (stream StreamingOutputCallResponse);
// A call that no server should implement
rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
} }
// A simple service NOT implemented at servers so clients can test for // A simple service NOT implemented at servers so clients can test for

@ -79,7 +79,8 @@ DEFINE_string(test_case, "large_unary",
"slow_consumer : single request with response streaming with " "slow_consumer : single request with response streaming with "
"slow client consumer;\n" "slow client consumer;\n"
"status_code_and_message: verify status code & message;\n" "status_code_and_message: verify status code & message;\n"
"timeout_on_sleeping_server: deadline exceeds on stream;\n"); "timeout_on_sleeping_server: deadline exceeds on stream;\n"
"unimplemented_method: client calls an unimplemented_method;\n");
DEFINE_string(default_service_account, "", DEFINE_string(default_service_account, "",
"Email of GCE default service account"); "Email of GCE default service account");
DEFINE_string(service_account_key_file, "", DEFINE_string(service_account_key_file, "",
@ -149,6 +150,8 @@ int main(int argc, char** argv) {
client.DoStatusWithMessage(); client.DoStatusWithMessage();
} else if (FLAGS_test_case == "custom_metadata") { } else if (FLAGS_test_case == "custom_metadata") {
client.DoCustomMetadata(); client.DoCustomMetadata();
} else if (FLAGS_test_case == "unimplemented_method") {
client.DoUnimplementedMethod();
} else if (FLAGS_test_case == "all") { } else if (FLAGS_test_case == "all") {
client.DoEmpty(); client.DoEmpty();
client.DoLargeUnary(); client.DoLargeUnary();
@ -166,6 +169,7 @@ int main(int argc, char** argv) {
client.DoEmptyStream(); client.DoEmptyStream();
client.DoStatusWithMessage(); client.DoStatusWithMessage();
client.DoCustomMetadata(); client.DoCustomMetadata();
client.DoUnimplementedMethod();
// service_account_creds and jwt_token_creds can only run with ssl. // service_account_creds and jwt_token_creds can only run with ssl.
if (FLAGS_use_tls) { if (FLAGS_use_tls) {
grpc::string json_key = GetServiceAccountJsonKey(); grpc::string json_key = GetServiceAccountJsonKey();
@ -198,7 +202,8 @@ int main(int argc, char** argv) {
"server_compressed_unary", "server_compressed_unary",
"server_streaming", "server_streaming",
"status_code_and_message", "status_code_and_message",
"timeout_on_sleeping_server"}; "timeout_on_sleeping_server",
"unimplemented_method"};
char* joined_testcases = char* joined_testcases =
gpr_strjoin_sep(testcases, GPR_ARRAY_SIZE(testcases), "\n", NULL); gpr_strjoin_sep(testcases, GPR_ARRAY_SIZE(testcases), "\n", NULL);

@ -937,5 +937,25 @@ bool InteropClient::DoCustomMetadata() {
return true; return true;
} }
bool InteropClient::DoUnimplementedMethod() {
gpr_log(GPR_DEBUG, "Sending a request for an unimplemented rpc...");
Empty request = Empty::default_instance();
Empty response = Empty::default_instance();
ClientContext context;
gpr_log(GPR_DEBUG, "here");
Status s = serviceStub_.Get()->UnimplementedCall(
&context, request, &response);
if (!AssertStatusCode(s, StatusCode::UNIMPLEMENTED)) {
return false;
}
gpr_log(GPR_DEBUG, "unimplemented rpc done.");
return true;
}
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc

@ -79,6 +79,7 @@ class InteropClient {
bool DoEmptyStream(); bool DoEmptyStream();
bool DoStatusWithMessage(); bool DoStatusWithMessage();
bool DoCustomMetadata(); bool DoCustomMetadata();
bool DoUnimplementedMethod();
// Auth tests. // Auth tests.
// username is a string containing the user email // username is a string containing the user email
bool DoJwtTokenCreds(const grpc::string& username); bool DoJwtTokenCreds(const grpc::string& username);

Loading…
Cancel
Save