@@ -212,13 +212,14 @@ class ClientLbEnd2endTest : public ::testing::Test {
212
212
bool SendRpc (
213
213
const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
214
214
EchoResponse* response = nullptr , int timeout_ms = 1000 ,
215
- Status* result = nullptr ) {
215
+ Status* result = nullptr , bool wait_for_ready = false ) {
216
216
const bool local_response = (response == nullptr );
217
217
if (local_response) response = new EchoResponse;
218
218
EchoRequest request;
219
219
request.set_message (kRequestMessage_ );
220
220
ClientContext context;
221
221
context.set_deadline (grpc_timeout_milliseconds_to_deadline (timeout_ms));
222
+ if (wait_for_ready) context.set_wait_for_ready (true );
222
223
Status status = stub->Echo (&context, request, response);
223
224
if (result != nullptr ) *result = status;
224
225
if (local_response) delete response;
@@ -227,10 +228,11 @@ class ClientLbEnd2endTest : public ::testing::Test {
227
228
228
229
void CheckRpcSendOk (
229
230
const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
230
- const grpc_core::DebugLocation& location) {
231
+ const grpc_core::DebugLocation& location, bool wait_for_ready = false ) {
231
232
EchoResponse response;
232
233
Status status;
233
- const bool success = SendRpc (stub, &response, 2000 , &status);
234
+ const bool success =
235
+ SendRpc (stub, &response, 2000 , &status, wait_for_ready);
234
236
ASSERT_TRUE (success) << " From " << location.file () << " :" << location.line ()
235
237
<< " \n "
236
238
<< " Error: " << status.error_message () << " "
@@ -301,7 +303,7 @@ class ClientLbEnd2endTest : public ::testing::Test {
301
303
if (ignore_failure) {
302
304
SendRpc (stub);
303
305
} else {
304
- CheckRpcSendOk (stub, location);
306
+ CheckRpcSendOk (stub, location, true );
305
307
}
306
308
} while (servers_[server_idx]->service_ .request_count () == 0 );
307
309
ResetCounters ();
@@ -506,7 +508,7 @@ TEST_F(ClientLbEnd2endTest, PickFirstUpdates) {
506
508
do {
507
509
channel_state = channel->GetState (true /* try to connect */ );
508
510
} while (channel_state == GRPC_CHANNEL_READY);
509
- GPR_ASSERT (channel_state != GRPC_CHANNEL_READY);
511
+ ASSERT_NE (channel_state, GRPC_CHANNEL_READY);
510
512
servers_[0 ]->service_ .ResetCounters ();
511
513
512
514
// Next update introduces servers_[1], making the channel recover.
@@ -830,7 +832,7 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
830
832
do {
831
833
channel_state = channel->GetState (true /* try to connect */ );
832
834
} while (channel_state == GRPC_CHANNEL_READY);
833
- GPR_ASSERT (channel_state != GRPC_CHANNEL_READY);
835
+ ASSERT_NE (channel_state, GRPC_CHANNEL_READY);
834
836
servers_[0 ]->service_ .ResetCounters ();
835
837
836
838
// Next update introduces servers_[1], making the channel recover.
@@ -839,7 +841,7 @@ TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
839
841
SetNextResolution (ports);
840
842
WaitForServer (stub, 1 , DEBUG_LOCATION);
841
843
channel_state = channel->GetState (false /* try to connect */ );
842
- GPR_ASSERT (channel_state == GRPC_CHANNEL_READY);
844
+ ASSERT_EQ (channel_state, GRPC_CHANNEL_READY);
843
845
844
846
// Check LB policy name for the channel.
845
847
EXPECT_EQ (" round_robin" , channel->GetLoadBalancingPolicyName ());
@@ -952,7 +954,7 @@ TEST_F(ClientLbEnd2endTest, RoundRobinReresolve) {
952
954
if (SendRpc (stub)) break ;
953
955
now = gpr_now (GPR_CLOCK_MONOTONIC);
954
956
}
955
- GPR_ASSERT (gpr_time_cmp (deadline, now) > 0 );
957
+ ASSERT_GT (gpr_time_cmp (deadline, now), 0 );
956
958
}
957
959
958
960
TEST_F (ClientLbEnd2endTest, RoundRobinSingleReconnect) {
0 commit comments