aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/interop
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-01-19 12:20:15 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-01-19 12:20:15 -0800
commitfb061c329ac5086b62619b118191574f3fd27a79 (patch)
tree6a855770d7218425a2cd53bc378800c30d6c8525 /test/cpp/interop
parent032e9b32dc5978a042bdda5c3031ae6cbd928973 (diff)
parent9813858908da2e7deaa58d91f4030e6881e364e3 (diff)
Merge remote-tracking branch 'upstream/master' into fix-stream-compression-config-interface
Diffstat (limited to 'test/cpp/interop')
-rw-r--r--test/cpp/interop/client.cc2
-rw-r--r--test/cpp/interop/http2_client.cc2
-rw-r--r--test/cpp/interop/interop_client.cc69
-rw-r--r--test/cpp/interop/interop_client.h6
-rw-r--r--test/cpp/interop/interop_server.cc2
-rw-r--r--test/cpp/interop/interop_test.cc2
6 files changed, 48 insertions, 35 deletions
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 716fb96382..8958b9884d 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -27,7 +27,7 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/lib/support/string.h"
+#include "src/core/lib/gpr/string.h"
#include "test/cpp/interop/client_helper.h"
#include "test/cpp/interop/interop_client.h"
#include "test/cpp/util/test_config.h"
diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc
index 2de7abcf17..7a9e3ced6a 100644
--- a/test/cpp/interop/http2_client.cc
+++ b/test/cpp/interop/http2_client.cc
@@ -30,7 +30,7 @@
#include "src/proto/grpc/testing/test.grpc.pb.h"
#include "test/cpp/interop/http2_client.h"
-#include "src/core/lib/support/string.h"
+#include "src/core/lib/gpr/string.h"
#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/util/test_config.h"
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index 24c6b3f188..6b59584353 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -122,7 +122,8 @@ InteropClient::InteropClient(std::shared_ptr<Channel> channel,
: serviceStub_(channel, new_stub_every_test_case),
do_not_abort_on_transient_failures_(do_not_abort_on_transient_failures) {}
-bool InteropClient::AssertStatusOk(const Status& s) {
+bool InteropClient::AssertStatusOk(const Status& s,
+ const grpc::string& optional_debug_string) {
if (s.ok()) {
return true;
}
@@ -131,17 +132,21 @@ bool InteropClient::AssertStatusOk(const Status& s) {
// already checked for s.ok() above). So, the following will call abort()
// (unless s.error_code() corresponds to a transient failure and
// 'do_not_abort_on_transient_failures' is true)
- return AssertStatusCode(s, StatusCode::OK);
+ return AssertStatusCode(s, StatusCode::OK, optional_debug_string);
}
-bool InteropClient::AssertStatusCode(const Status& s,
- StatusCode expected_code) {
+bool InteropClient::AssertStatusCode(
+ const Status& s, StatusCode expected_code,
+ const grpc::string& optional_debug_string) {
if (s.error_code() == expected_code) {
return true;
}
- gpr_log(GPR_ERROR, "Error status code: %d (expected: %d), message: %s",
- s.error_code(), expected_code, s.error_message().c_str());
+ gpr_log(GPR_ERROR,
+ "Error status code: %d (expected: %d), message: %s,"
+ " debug string: %s",
+ s.error_code(), expected_code, s.error_message().c_str(),
+ optional_debug_string.c_str());
// In case of transient transient/retryable failures (like a broken
// connection) we may or may not abort (see TransientFailureOrAbort())
@@ -161,7 +166,7 @@ bool InteropClient::DoEmpty() {
Status s = serviceStub_.Get()->EmptyCall(&context, request, &response);
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -191,7 +196,7 @@ bool InteropClient::PerformLargeUnary(SimpleRequest* request,
}
Status s = serviceStub_.Get()->UnaryCall(&context, *request, response);
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -241,7 +246,7 @@ bool InteropClient::DoOauth2AuthToken(const grpc::string& username,
Status s = serviceStub_.Get()->UnaryCall(&context, request, &response);
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -269,7 +274,7 @@ bool InteropClient::DoPerRpcCreds(const grpc::string& json_key) {
Status s = serviceStub_.Get()->UnaryCall(&context, request, &response);
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -412,7 +417,7 @@ bool InteropClient::DoRequestStreaming() {
GPR_ASSERT(stream->WritesDone());
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -451,7 +456,7 @@ bool InteropClient::DoResponseStreaming() {
}
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -516,7 +521,7 @@ bool InteropClient::DoClientCompressedStreaming() {
GPR_ASSERT(stream->WritesDone());
s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -578,7 +583,7 @@ bool InteropClient::DoServerCompressedStreaming() {
}
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
return true;
@@ -619,7 +624,7 @@ bool InteropClient::DoResponseStreamingWithSlowConsumer() {
}
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -666,7 +671,7 @@ bool InteropClient::DoHalfDuplex() {
}
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -710,7 +715,7 @@ bool InteropClient::DoPingPong() {
GPR_ASSERT(!stream->Read(&response));
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -732,7 +737,8 @@ bool InteropClient::DoCancelAfterBegin() {
context.TryCancel();
Status s = stream->Finish();
- if (!AssertStatusCode(s, StatusCode::CANCELLED)) {
+ if (!AssertStatusCode(s, StatusCode::CANCELLED,
+ context.debug_error_string())) {
return false;
}
@@ -790,7 +796,8 @@ bool InteropClient::DoTimeoutOnSleepingServer() {
stream->Write(request);
Status s = stream->Finish();
- if (!AssertStatusCode(s, StatusCode::DEADLINE_EXCEEDED)) {
+ if (!AssertStatusCode(s, StatusCode::DEADLINE_EXCEEDED,
+ context.debug_error_string())) {
return false;
}
@@ -810,7 +817,7 @@ bool InteropClient::DoEmptyStream() {
GPR_ASSERT(stream->Read(&response) == false);
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -833,7 +840,8 @@ bool InteropClient::DoStatusWithMessage() {
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)) {
+ if (!AssertStatusCode(s, grpc::StatusCode::UNKNOWN,
+ context.debug_error_string())) {
return false;
}
GPR_ASSERT(s.error_message() == test_msg);
@@ -853,7 +861,8 @@ bool InteropClient::DoStatusWithMessage() {
while (stream->Read(&streaming_response))
;
s = stream->Finish();
- if (!AssertStatusCode(s, grpc::StatusCode::UNKNOWN)) {
+ if (!AssertStatusCode(s, grpc::StatusCode::UNKNOWN,
+ context.debug_error_string())) {
return false;
}
GPR_ASSERT(s.error_message() == test_msg);
@@ -880,7 +889,7 @@ bool InteropClient::DoCacheableUnary() {
context1.AddMetadata("x-user-ip", "1.2.3.4");
Status s1 =
serviceStub_.Get()->CacheableUnaryCall(&context1, request, &response1);
- if (!AssertStatusOk(s1)) {
+ if (!AssertStatusOk(s1, context1.debug_error_string())) {
return false;
}
gpr_log(GPR_DEBUG, "response 1 payload: %s",
@@ -893,7 +902,7 @@ bool InteropClient::DoCacheableUnary() {
context2.AddMetadata("x-user-ip", "1.2.3.4");
Status s2 =
serviceStub_.Get()->CacheableUnaryCall(&context2, request, &response2);
- if (!AssertStatusOk(s2)) {
+ if (!AssertStatusOk(s2, context2.debug_error_string())) {
return false;
}
gpr_log(GPR_DEBUG, "response 2 payload: %s",
@@ -915,7 +924,7 @@ bool InteropClient::DoCacheableUnary() {
context3.AddMetadata("x-user-ip", "1.2.3.4");
Status s3 =
serviceStub_.Get()->CacheableUnaryCall(&context3, request1, &response3);
- if (!AssertStatusOk(s3)) {
+ if (!AssertStatusOk(s3, context3.debug_error_string())) {
return false;
}
gpr_log(GPR_DEBUG, "response 3 payload: %s",
@@ -946,7 +955,7 @@ bool InteropClient::DoCustomMetadata() {
request.mutable_payload()->set_body(payload.c_str(), kLargeRequestSize);
Status s = serviceStub_.Get()->UnaryCall(&context, request, &response);
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -997,7 +1006,7 @@ bool InteropClient::DoCustomMetadata() {
GPR_ASSERT(!stream->Read(&response));
Status s = stream->Finish();
- if (!AssertStatusOk(s)) {
+ if (!AssertStatusOk(s, context.debug_error_string())) {
return false;
}
@@ -1028,7 +1037,8 @@ bool InteropClient::DoUnimplementedService() {
Status s = stub->UnimplementedCall(&context, request, &response);
- if (!AssertStatusCode(s, StatusCode::UNIMPLEMENTED)) {
+ if (!AssertStatusCode(s, StatusCode::UNIMPLEMENTED,
+ context.debug_error_string())) {
return false;
}
@@ -1046,7 +1056,8 @@ bool InteropClient::DoUnimplementedMethod() {
Status s =
serviceStub_.Get()->UnimplementedCall(&context, request, &response);
- if (!AssertStatusCode(s, StatusCode::UNIMPLEMENTED)) {
+ if (!AssertStatusCode(s, StatusCode::UNIMPLEMENTED,
+ context.debug_error_string())) {
return false;
}
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index 57e8ba63f5..b8bb134c20 100644
--- a/test/cpp/interop/interop_client.h
+++ b/test/cpp/interop/interop_client.h
@@ -103,8 +103,10 @@ class InteropClient {
/// Run \a custom_check_fn as an additional check.
bool PerformLargeUnary(SimpleRequest* request, SimpleResponse* response,
CheckerFn custom_checks_fn);
- bool AssertStatusOk(const Status& s);
- bool AssertStatusCode(const Status& s, StatusCode expected_code);
+ bool AssertStatusOk(const Status& s,
+ const grpc::string& optional_debug_string);
+ bool AssertStatusCode(const Status& s, StatusCode expected_code,
+ const grpc::string& optional_debug_string);
bool TransientFailureOrAbort();
ServiceStub serviceStub_;
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index 30bd8bfef8..7cfdb2f9e9 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -31,7 +31,7 @@
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
-#include "src/core/lib/support/string.h"
+#include "src/core/lib/gpr/string.h"
#include "src/core/lib/transport/byte_stream.h"
#include "src/proto/grpc/testing/empty.pb.h"
#include "src/proto/grpc/testing/messages.pb.h"
diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc
index 1bf0d8d10f..563b7abb5e 100644
--- a/test/cpp/interop/interop_test.cc
+++ b/test/cpp/interop/interop_test.cc
@@ -37,8 +37,8 @@
#include "test/core/util/port.h"
#include "test/cpp/util/test_config.h"
+#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
-#include "src/core/lib/support/string.h"
DEFINE_string(extra_server_flags, "", "Extra flags to pass to server.");