Reviewer feedback

pull/16044/head
ncteisen 7 years ago
parent b6597b4fbd
commit 12f1cc059b
  1. 15
      test/cpp/interop/client.cc
  2. 20
      test/cpp/interop/interop_client.cc
  3. 4
      test/cpp/interop/interop_client.h

@ -46,7 +46,7 @@ DEFINE_string(
"all : all test cases;\n"
"cancel_after_begin : cancel stream after starting it;\n"
"cancel_after_first_response: cancel on first response;\n"
"channel_soak: sends 1000 rpcs, tearing down the channel each time;\n"
"channel_soak: sends 'soak_iterations' rpcs, rebuilds channel each time;\n"
"client_compressed_streaming : compressed request streaming with "
"client_compressed_unary : single compressed request;\n"
"client_streaming : request streaming with single response;\n"
@ -61,7 +61,7 @@ DEFINE_string(
"per_rpc_creds: raw oauth2 access token on a single rpc;\n"
"ping_pong : full-duplex streaming;\n"
"response streaming;\n"
"rpc_soak: sends 1000 large_unary rpcs;\n"
"rpc_soak: 'sends soak_iterations' large_unary rpcs;\n"
"server_compressed_streaming : single request with compressed "
"server_compressed_unary : single compressed response;\n"
"server_streaming : single request with response streaming;\n"
@ -85,6 +85,10 @@ DEFINE_bool(do_not_abort_on_transient_failures, false,
"test is retried in case of transient failures (and currently the "
"interop tests are not retried even if this flag is set to true)");
DEFINE_int32(soak_iterations, 1000,
"number of iterations to use for the two soak tests; rpc_soak and "
"channel_soak");
using grpc::testing::CreateChannelForTestCase;
using grpc::testing::GetServiceAccountJsonKey;
using grpc::testing::UpdateActions;
@ -155,9 +159,10 @@ int main(int argc, char** argv) {
actions["cacheable_unary"] =
std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client);
actions["channel_soak"] =
std::bind(&grpc::testing::InteropClient::DoChannelSoakTest, &client);
actions["rpc_soak"] =
std::bind(&grpc::testing::InteropClient::DoRpcSoakTest, &client);
std::bind(&grpc::testing::InteropClient::DoChannelSoakTest, &client,
FLAGS_soak_iterations);
actions["rpc_soak"] = std::bind(&grpc::testing::InteropClient::DoRpcSoakTest,
&client, FLAGS_soak_iterations);
UpdateActions(&actions);

@ -106,8 +106,6 @@ void InteropClient::ServiceStub::ResetChannel() {
channel_ = channel_creation_func_();
if (!new_stub_every_call_) {
stub_ = TestService::NewStub(channel_);
} else {
stub_.reset();
}
}
@ -1022,12 +1020,14 @@ bool InteropClient::DoCustomMetadata() {
return true;
}
bool InteropClient::DoRpcSoakTest() {
gpr_log(GPR_DEBUG, "Sending 1000 RPCs...");
bool InteropClient::DoRpcSoakTest(int32_t soak_iterations) {
gpr_log(GPR_DEBUG, "Sending %d RPCs...", soak_iterations);
GPR_ASSERT(soak_iterations > 0);
SimpleRequest request;
SimpleResponse response;
for (int i = 0; i < 1000; ++i) {
for (int i = 0; i < soak_iterations; ++i) {
if (!PerformLargeUnary(&request, &response)) {
gpr_log(GPR_ERROR, "rpc_soak test failed on iteration %d", i);
return false;
}
}
@ -1035,14 +1035,16 @@ bool InteropClient::DoRpcSoakTest() {
return true;
}
bool InteropClient::DoChannelSoakTest() {
gpr_log(GPR_DEBUG,
"Sending 1000 RPCs, tearing down the channel each time...");
bool InteropClient::DoChannelSoakTest(int32_t soak_iterations) {
gpr_log(GPR_DEBUG, "Sending %d RPCs, tearing down the channel each time...",
soak_iterations);
GPR_ASSERT(soak_iterations > 0);
SimpleRequest request;
SimpleResponse response;
for (int i = 0; i < 1000; ++i) {
for (int i = 0; i < soak_iterations; ++i) {
serviceStub_.ResetChannel();
if (!PerformLargeUnary(&request, &response)) {
gpr_log(GPR_ERROR, "channel_soak test failed on iteration %d", i);
return false;
}
}

@ -74,8 +74,8 @@ class InteropClient {
// not implemented cross-language. They are considered experimental for now,
// but at some point in the future, might be codified and implemented in all
// languages
bool DoChannelSoakTest();
bool DoRpcSoakTest();
bool DoChannelSoakTest(int32_t soak_iterations);
bool DoRpcSoakTest(int32_t soak_iterations);
// Auth tests.
// username is a string containing the user email

Loading…
Cancel
Save