Merge pull request #24173 from yashykt/interopspecialstatusmessage

Add interop test for special_status_message
pull/24174/head
Yash Tibrewal 4 years ago committed by GitHub
commit eb293a778f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      test/cpp/interop/client.cc
  2. 24
      test/cpp/interop/interop_client.cc
  3. 2
      test/cpp/interop/interop_client.h

@ -70,6 +70,7 @@ DEFINE_string(
"server_streaming : single request with response streaming;\n"
"slow_consumer : single request with response streaming with "
"slow client consumer;\n"
"special_status_message: verify Unicode and whitespace in status message;\n"
"status_code_and_message: verify status code & message;\n"
"timeout_on_sleeping_server: deadline exceeds on stream;\n"
"unimplemented_method: client calls an unimplemented method;\n"
@ -258,6 +259,8 @@ int main(int argc, char** argv) {
}
actions["status_code_and_message"] =
std::bind(&grpc::testing::InteropClient::DoStatusWithMessage, &client);
actions["special_status_message"] =
std::bind(&grpc::testing::InteropClient::DoSpecialStatusMessage, &client);
actions["custom_metadata"] =
std::bind(&grpc::testing::InteropClient::DoCustomMetadata, &client);
actions["unimplemented_method"] =

@ -885,6 +885,30 @@ bool InteropClient::DoStatusWithMessage() {
return true;
}
bool InteropClient::DoSpecialStatusMessage() {
gpr_log(
GPR_DEBUG,
"Sending RPC with a request for status code 2 and message - \\t\\ntest "
"with whitespace\\r\\nand Unicode BMP ☺ and non-BMP 😈\\t\\n");
const grpc::StatusCode test_code = grpc::StatusCode::UNKNOWN;
const std::string test_msg =
"\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n";
ClientContext context;
SimpleRequest request;
SimpleResponse response;
EchoStatus* requested_status = request.mutable_response_status();
requested_status->set_code(test_code);
requested_status->set_message(test_msg);
Status s = serviceStub_.Get()->UnaryCall(&context, request, &response);
if (!AssertStatusCode(s, grpc::StatusCode::UNKNOWN,
context.debug_error_string())) {
return false;
}
GPR_ASSERT(s.error_message() == test_msg);
gpr_log(GPR_DEBUG, "Done testing Special Status Message");
return true;
}
bool InteropClient::DoCacheableUnary() {
gpr_log(GPR_DEBUG, "Sending RPC with cacheable response");

@ -65,6 +65,8 @@ class InteropClient {
bool DoTimeoutOnSleepingServer();
bool DoEmptyStream();
bool DoStatusWithMessage();
// Verifies Unicode and Whitespace is correctly processed in status message.
bool DoSpecialStatusMessage();
bool DoCustomMetadata();
bool DoUnimplementedMethod();
bool DoUnimplementedService();

Loading…
Cancel
Save