Fix C++ status_code_and_message test to comply with the spec.

Enable C++ test in run_interop_tests.py.
pull/7201/head
Mark D. Roth 9 years ago
parent 71ed007847
commit dbf2adc980
  1. 28
      test/cpp/interop/interop_client.cc
  2. 5
      test/cpp/interop/interop_server.cc
  3. 12
      tools/run_tests/run_interop_tests.py

@ -827,21 +827,41 @@ bool InteropClient::DoStatusWithMessage() {
gpr_log(GPR_DEBUG,
"Sending RPC with a request for status code 2 and message");
const grpc::StatusCode test_code = grpc::StatusCode::UNKNOWN;
const grpc::string test_msg = "This is a test message";
ClientContext context;
// Test UnaryCall.
SimpleRequest request;
SimpleResponse response;
EchoStatus* requested_status = request.mutable_response_status();
requested_status->set_code(grpc::StatusCode::UNKNOWN);
grpc::string test_msg = "This is a test message";
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)) {
return false;
}
GPR_ASSERT(s.error_message() == test_msg);
// Test FullDuplexCall.
std::shared_ptr<ClientReaderWriter<StreamingOutputCallRequest,
StreamingOutputCallResponse>>
stream(serviceStub_.Get()->FullDuplexCall(&context));
StreamingOutputCallRequest streaming_request;
requested_status = streaming_request.mutable_response_status();
requested_status->set_code(test_code);
requested_status->set_message(test_msg);
stream->Write(streaming_request);
stream->WritesDone();
StreamingOutputCallResponse streaming_response;
while (stream->Read(&streaming_response))
;
s = stream->Finish();
if (!AssertStatusCode(s, grpc::StatusCode::UNKNOWN)) {
return false;
}
GPR_ASSERT(s.error_message() == test_msg);
gpr_log(GPR_DEBUG, "Done testing Status and Message");
return true;
}

@ -259,6 +259,11 @@ class TestServiceImpl : public TestService::Service {
StreamingOutputCallResponse response;
bool write_success = true;
while (write_success && stream->Read(&request)) {
if (request.has_response_status()) {
return Status(
static_cast<grpc::StatusCode>(request.response_status().code()),
request.response_status().message());
}
if (request.response_parameters_size() != 0) {
response.mutable_payload()->set_type(request.payload().type());
response.mutable_payload()->set_body(

@ -59,9 +59,9 @@ _SKIP_COMPRESSION = ['client_compressed_unary',
'server_compressed_unary',
'server_compressed_streaming']
_SKIP_ADVANCED_GO = ['custom_metadata', 'unimplemented_method']
_SKIP_ADVANCED_CXX_AND_GO = ['custom_metadata', 'unimplemented_method']
_SKIP_ADVANCED = _SKIP_ADVANCED_GO + ['status_code_and_message']
_SKIP_ADVANCED = _SKIP_ADVANCED_CXX_AND_GO + ['status_code_and_message']
_TEST_TIMEOUT = 3*60
@ -85,10 +85,10 @@ class CXXLanguage:
return {}
def unimplemented_test_cases(self):
return _SKIP_ADVANCED
return _SKIP_ADVANCED_CXX_AND_GO
def unimplemented_test_cases_server(self):
return _SKIP_ADVANCED
return _SKIP_ADVANCED_CXX_AND_GO
def __str__(self):
return 'c++'
@ -173,10 +173,10 @@ class GoLanguage:
return {}
def unimplemented_test_cases(self):
return _SKIP_ADVANCED_GO + _SKIP_COMPRESSION
return _SKIP_ADVANCED_CXX_AND_GO + _SKIP_COMPRESSION
def unimplemented_test_cases_server(self):
return _SKIP_ADVANCED_GO + _SKIP_COMPRESSION
return _SKIP_ADVANCED_CXX_AND_GO + _SKIP_COMPRESSION
def __str__(self):
return 'go'

Loading…
Cancel
Save