From 12f1cc059b037e3853185d3e740ca2b16f1f5495 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 18 Jul 2018 07:33:08 -0700 Subject: Reviewer feedback --- test/cpp/interop/client.cc | 15 ++++++++++----- test/cpp/interop/interop_client.cc | 20 +++++++++++--------- test/cpp/interop/interop_client.h | 4 ++-- 3 files changed, 23 insertions(+), 16 deletions(-) (limited to 'test/cpp/interop') diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 3fae443681..7bcf23c0eb 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -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); diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index a023e8776b..b7ce90803b 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -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; } } diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 3033d7b414..e5be44d1d4 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -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 -- cgit v1.2.3