Merge pull request #20551 from soheilhy/fix-benchmark-flaky

Deflake QPS test.
pull/20277/head
Soheil Hassas Yeganeh 5 years ago committed by GitHub
commit 5529c7c218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      test/cpp/qps/driver.cc

@ -495,8 +495,13 @@ std::unique_ptr<ScenarioResult> RunScenario(
for (size_t i = 0; i < num_clients; i++) { for (size_t i = 0; i < num_clients; i++) {
auto client = &clients[i]; auto client = &clients[i];
Status s = client->stream->Finish(); Status s = client->stream->Finish();
result->add_client_success(s.ok()); // Since we shutdown servers and clients at the same time, clients can
if (!s.ok()) { // observe cancellation. Thus, we consider both OK and CANCELLED as good
// status.
const bool success = s.ok() || static_cast<StatusCode>(s.error_code()) ==
StatusCode::CANCELLED;
result->add_client_success(success);
if (!success) {
gpr_log(GPR_ERROR, "Client %zu had an error %s", i, gpr_log(GPR_ERROR, "Client %zu had an error %s", i,
s.error_message().c_str()); s.error_message().c_str());
} }
@ -526,8 +531,13 @@ std::unique_ptr<ScenarioResult> RunScenario(
for (size_t i = 0; i < num_servers; i++) { for (size_t i = 0; i < num_servers; i++) {
auto server = &servers[i]; auto server = &servers[i];
Status s = server->stream->Finish(); Status s = server->stream->Finish();
result->add_server_success(s.ok()); // Since we shutdown servers and clients at the same time, servers can
if (!s.ok()) { // observe cancellation. Thus, we consider both OK and CANCELLED as good
// status.
const bool success = s.ok() || static_cast<StatusCode>(s.error_code()) ==
StatusCode::CANCELLED;
result->add_server_success(success);
if (!success) {
gpr_log(GPR_ERROR, "Server %zu had an error %s", i, gpr_log(GPR_ERROR, "Server %zu had an error %s", i,
s.error_message().c_str()); s.error_message().c_str());
} }

Loading…
Cancel
Save