Fixed ClientLbEnd2endTest.RoundRobinReresolve flakiness

pull/13663/head
David Garcia Quintas 7 years ago
parent 39820e676e
commit d5ca876b6d
  1. 21
      test/cpp/end2end/client_lb_end2end_test.cc

@ -573,15 +573,28 @@ TEST_F(ClientLbEnd2endTest, RoundRobinReresolve) {
CheckRpcSendOk(); CheckRpcSendOk();
} }
// Kill all servers // Kill all servers
gpr_log(GPR_INFO, "****** ABOUT TO KILL SERVERS *******");
for (size_t i = 0; i < servers_.size(); ++i) { for (size_t i = 0; i < servers_.size(); ++i) {
servers_[i]->Shutdown(false); servers_[i]->Shutdown(false);
} }
// Client request should fail. gpr_log(GPR_INFO, "****** SERVERS KILLED *******");
CheckRpcSendFailure(); gpr_log(GPR_INFO, "****** SENDING DOOMED REQUESTS *******");
// Client requests should fail. Send enough to tickle all subchannels.
for (size_t i = 0; i < servers_.size(); ++i) CheckRpcSendFailure();
gpr_log(GPR_INFO, "****** DOOMED REQUESTS SENT *******");
// Bring servers back up on the same port (we aren't recreating the channel). // Bring servers back up on the same port (we aren't recreating the channel).
gpr_log(GPR_INFO, "****** RESTARTING SERVERS *******");
StartServers(kNumServers, ports); StartServers(kNumServers, ports);
// Client request should succeed. gpr_log(GPR_INFO, "****** SERVERS RESTARTED *******");
CheckRpcSendOk(); gpr_log(GPR_INFO, "****** SENDING REQUEST TO SUCCEED *******");
// Client request should eventually (but still fairly soon) succeed.
bool call_succeeded = false;
for (gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5);
gpr_time_cmp(deadline, gpr_now(GPR_CLOCK_MONOTONIC)) > 0;) {
call_succeeded = SendRpc().ok();
if (call_succeeded) break;
}
GPR_ASSERT(call_succeeded);
} }
} // namespace } // namespace

Loading…
Cancel
Save