From e169f20cd0330484339795685417abc962edf5d2 Mon Sep 17 00:00:00 2001 From: kpayson64 Date: Wed, 23 May 2018 09:38:00 -0700 Subject: [PATCH] Add more failure logging to client_lb_end2end_test --- test/cpp/end2end/client_lb_end2end_test.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index a39e443cf0b..9a0f6b6c2d5 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -198,7 +198,8 @@ class ClientLbEnd2endTest : public ::testing::Test { bool SendRpc( const std::unique_ptr& stub, - EchoResponse* response = nullptr, int timeout_ms = 1000) { + EchoResponse* response = nullptr, int timeout_ms = 1000, + Status* result = nullptr) { const bool local_response = (response == nullptr); if (local_response) response = new EchoResponse; EchoRequest request; @@ -206,6 +207,7 @@ class ClientLbEnd2endTest : public ::testing::Test { ClientContext context; context.set_deadline(grpc_timeout_milliseconds_to_deadline(timeout_ms)); Status status = stub->Echo(&context, request, response); + if (result != nullptr) *result = status; if (local_response) delete response; return status.ok(); } @@ -214,12 +216,15 @@ class ClientLbEnd2endTest : public ::testing::Test { const std::unique_ptr& stub, const grpc_core::DebugLocation& location) { EchoResponse response; - const bool success = SendRpc(stub, &response); - if (!success) abort(); - ASSERT_TRUE(success) << "From " << location.file() << ":" - << location.line(); + Status status; + const bool success = SendRpc(stub, &response, 2000, &status); + ASSERT_TRUE(success) << "From " << location.file() << ":" << location.line() + << "\n" + << "Error: " << status.error_message() << " " + << status.error_details(); ASSERT_EQ(response.message(), kRequestMessage_) << "From " << location.file() << ":" << location.line(); + if (!success) abort(); } void CheckRpcSendFailure(