diff options
Diffstat (limited to 'test/cpp/interop')
-rw-r--r-- | test/cpp/interop/interop_client.cc | 12 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.h | 7 | ||||
-rw-r--r-- | test/cpp/interop/stress_interop_client.cc | 5 | ||||
-rw-r--r-- | test/cpp/interop/stress_interop_client.h | 4 |
4 files changed, 16 insertions, 12 deletions
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 68bf1e6dc7..aaaa21de5b 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -19,6 +19,7 @@ #include <cinttypes> #include <fstream> #include <memory> +#include <utility> #include <grpc/grpc.h> #include <grpc/support/alloc.h> @@ -73,7 +74,7 @@ void UnaryCompressionChecks(const InteropClientContextInspector& inspector, } } // namespace -InteropClient::ServiceStub::ServiceStub(std::shared_ptr<Channel> channel, +InteropClient::ServiceStub::ServiceStub(const std::shared_ptr<Channel>& channel, bool new_stub_every_call) : channel_(channel), new_stub_every_call_(new_stub_every_call) { // If new_stub_every_call is false, then this is our chance to initialize @@ -99,7 +100,8 @@ InteropClient::ServiceStub::GetUnimplementedServiceStub() { return unimplemented_service_stub_.get(); } -void InteropClient::ServiceStub::Reset(std::shared_ptr<Channel> channel) { +void InteropClient::ServiceStub::Reset( + const std::shared_ptr<Channel>& channel) { channel_ = channel; // Update stub_ as well. Note: If new_stub_every_call_ is true, we can reset @@ -112,13 +114,13 @@ void InteropClient::ServiceStub::Reset(std::shared_ptr<Channel> channel) { } void InteropClient::Reset(std::shared_ptr<Channel> channel) { - serviceStub_.Reset(channel); + serviceStub_.Reset(std::move(channel)); } InteropClient::InteropClient(std::shared_ptr<Channel> channel, bool new_stub_every_test_case, bool do_not_abort_on_transient_failures) - : serviceStub_(channel, new_stub_every_test_case), + : serviceStub_(std::move(channel), new_stub_every_test_case), do_not_abort_on_transient_failures_(do_not_abort_on_transient_failures) {} bool InteropClient::AssertStatusOk(const Status& s, @@ -180,7 +182,7 @@ bool InteropClient::PerformLargeUnary(SimpleRequest* request, bool InteropClient::PerformLargeUnary(SimpleRequest* request, SimpleResponse* response, - CheckerFn custom_checks_fn) { + const CheckerFn& custom_checks_fn) { ClientContext context; InteropClientContextInspector inspector(context); request->set_response_size(kLargeResponseSize); diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 79ff24fc47..a146212ff6 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -83,12 +83,13 @@ class InteropClient { public: // If new_stub_every_call = true, pointer to a new instance of // TestServce::Stub is returned by Get() everytime it is called - ServiceStub(std::shared_ptr<Channel> channel, bool new_stub_every_call); + ServiceStub(const std::shared_ptr<Channel>& channel, + bool new_stub_every_call); TestService::Stub* Get(); UnimplementedService::Stub* GetUnimplementedServiceStub(); - void Reset(std::shared_ptr<Channel> channel); + void Reset(const std::shared_ptr<Channel>& channel); private: std::unique_ptr<TestService::Stub> stub_; @@ -102,7 +103,7 @@ class InteropClient { /// Run \a custom_check_fn as an additional check. bool PerformLargeUnary(SimpleRequest* request, SimpleResponse* response, - CheckerFn custom_checks_fn); + const CheckerFn& custom_checks_fn); bool AssertStatusOk(const Status& s, const grpc::string& optional_debug_string); bool AssertStatusCode(const Status& s, StatusCode expected_code, diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc index 30a8351cfe..9d373c3cd9 100644 --- a/test/cpp/interop/stress_interop_client.cc +++ b/test/cpp/interop/stress_interop_client.cc @@ -68,7 +68,7 @@ TestCaseType WeightedRandomTestSelector::GetNextTest() const { StressTestInteropClient::StressTestInteropClient( int test_id, const grpc::string& server_address, - std::shared_ptr<Channel> channel, + const std::shared_ptr<Channel>& channel, const WeightedRandomTestSelector& test_selector, long test_duration_secs, long sleep_duration_ms, bool do_not_abort_on_transient_failures) : test_id_(test_id), @@ -80,7 +80,8 @@ StressTestInteropClient::StressTestInteropClient( test_duration_secs_(test_duration_secs), sleep_duration_ms_(sleep_duration_ms) {} -void StressTestInteropClient::MainLoop(std::shared_ptr<QpsGauge> qps_gauge) { +void StressTestInteropClient::MainLoop( + const std::shared_ptr<QpsGauge>& qps_gauge) { gpr_log(GPR_INFO, "Running test %d. ServerAddr: %s", test_id_, server_address_.c_str()); diff --git a/test/cpp/interop/stress_interop_client.h b/test/cpp/interop/stress_interop_client.h index a306dc3565..e4fa7d0973 100644 --- a/test/cpp/interop/stress_interop_client.h +++ b/test/cpp/interop/stress_interop_client.h @@ -91,14 +91,14 @@ class WeightedRandomTestSelector { class StressTestInteropClient { public: StressTestInteropClient(int test_id, const grpc::string& server_address, - std::shared_ptr<Channel> channel, + const std::shared_ptr<Channel>& channel, const WeightedRandomTestSelector& test_selector, long test_duration_secs, long sleep_duration_ms, bool do_not_abort_on_transient_failures); // The main function. Use this as the thread entry point. // qps_gauge is the QpsGauge to record the requests per second metric - void MainLoop(std::shared_ptr<QpsGauge> qps_gauge); + void MainLoop(const std::shared_ptr<QpsGauge>& qps_gauge); private: bool RunTest(TestCaseType test_case); |