diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/core/client_config/uri_parser_test.c | 1 | ||||
-rw-r--r-- | test/core/support/useful_test.c | 14 | ||||
-rw-r--r-- | test/cpp/common/auth_property_iterator_test.cc | 101 | ||||
-rw-r--r-- | test/cpp/common/secure_auth_context_test.cc | 46 | ||||
-rw-r--r-- | test/cpp/end2end/client_crash_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/end2end/mock_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/end2end/server_crash_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/end2end/thread_stress_test.cc | 4 | ||||
-rw-r--r-- | test/cpp/interop/client.cc | 5 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.cc | 21 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.h | 1 | ||||
-rw-r--r-- | test/cpp/interop/server.cc | 12 | ||||
-rw-r--r-- | test/cpp/interop/server_helper.cc | 13 | ||||
-rw-r--r-- | test/cpp/interop/server_helper.h | 13 | ||||
-rw-r--r-- | test/cpp/qps/server_async.cc | 2 | ||||
-rw-r--r-- | test/cpp/qps/server_sync.cc | 4 | ||||
-rw-r--r-- | test/cpp/server/fixed_size_thread_pool_test.cc (renamed from test/cpp/server/thread_pool_test.cc) | 10 | ||||
-rw-r--r-- | test/cpp/util/cli_call_test.cc | 4 |
19 files changed, 236 insertions, 29 deletions
diff --git a/test/core/client_config/uri_parser_test.c b/test/core/client_config/uri_parser_test.c index e5f9017ce0..3451ca1e8c 100644 --- a/test/core/client_config/uri_parser_test.c +++ b/test/core/client_config/uri_parser_test.c @@ -60,6 +60,7 @@ int main(int argc, char **argv) { test_succeeds("http://www.google.com:90", "http", "www.google.com:90", ""); test_succeeds("a192.4-df:foo.coom", "a192.4-df", "", "foo.coom"); test_succeeds("a+b:foo.coom", "a+b", "", "foo.coom"); + test_succeeds("zookeeper://127.0.0.1:2181/foo/bar", "zookeeper", "127.0.0.1:2181", "/foo/bar"); test_fails("xyz"); test_fails("http://www.google.com?why-are-you-using-queries"); test_fails("dns:foo.com#fragments-arent-supported-here"); diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.c index feaf436379..cbf4f02e26 100644 --- a/test/core/support/useful_test.c +++ b/test/core/support/useful_test.c @@ -39,6 +39,7 @@ int main(int argc, char **argv) { int four[4]; int five[5]; + gpr_uint32 bitset = 0; grpc_test_init(argc, argv); GPR_ASSERT(GPR_MIN(1, 2) == 1); @@ -55,5 +56,18 @@ int main(int argc, char **argv) { GPR_ASSERT(GPR_ARRAY_SIZE(four) == 4); GPR_ASSERT(GPR_ARRAY_SIZE(five) == 5); + GPR_ASSERT(GPR_BITCOUNT((1u << 31) - 1) == 31); + GPR_ASSERT(GPR_BITCOUNT(1u << 3) == 1); + GPR_ASSERT(GPR_BITCOUNT(0) == 0); + + GPR_ASSERT(GPR_BITSET(&bitset, 3) == 8); + GPR_ASSERT(GPR_BITCOUNT(bitset) == 1); + GPR_ASSERT(GPR_BITGET(bitset, 3) == 1); + GPR_ASSERT(GPR_BITSET(&bitset, 1) == 10); + GPR_ASSERT(GPR_BITCOUNT(bitset) == 2); + GPR_ASSERT(GPR_BITCLEAR(&bitset, 3) == 2); + GPR_ASSERT(GPR_BITCOUNT(bitset) == 1); + GPR_ASSERT(GPR_BITGET(bitset, 3) == 0); + return 0; } diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc new file mode 100644 index 0000000000..3d983fa310 --- /dev/null +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -0,0 +1,101 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include <grpc++/auth_context.h> +#include <gtest/gtest.h> +#include "src/cpp/common/secure_auth_context.h" +#include "src/core/security/security_context.h" + +namespace grpc { +namespace { + +class TestAuthPropertyIterator : public AuthPropertyIterator { + public: + TestAuthPropertyIterator() {} + TestAuthPropertyIterator(const grpc_auth_property* property, + const grpc_auth_property_iterator* iter) + : AuthPropertyIterator(property, iter) {} +}; + +class AuthPropertyIteratorTest : public ::testing::Test { + protected: + void SetUp() GRPC_OVERRIDE { + ctx_ = grpc_auth_context_create(NULL, 3); + ctx_->properties[0] = grpc_auth_property_init_from_cstring("name", "chapi"); + ctx_->properties[1] = grpc_auth_property_init_from_cstring("name", "chapo"); + ctx_->properties[2] = grpc_auth_property_init_from_cstring("foo", "bar"); + ctx_->peer_identity_property_name = ctx_->properties[0].name; + } + void TearDown() GRPC_OVERRIDE { + GRPC_AUTH_CONTEXT_UNREF(ctx_, "AuthPropertyIteratorTest"); + } + grpc_auth_context* ctx_; + +}; + +TEST_F(AuthPropertyIteratorTest, DefaultCtor) { + TestAuthPropertyIterator iter1; + TestAuthPropertyIterator iter2; + EXPECT_EQ(iter1, iter2); +} + +TEST_F(AuthPropertyIteratorTest, GeneralTest) { + grpc_auth_property_iterator c_iter = + grpc_auth_context_property_iterator(ctx_); + const grpc_auth_property* property = + grpc_auth_property_iterator_next(&c_iter); + TestAuthPropertyIterator iter(property, &c_iter); + TestAuthPropertyIterator empty_iter; + EXPECT_FALSE(iter == empty_iter); + AuthProperty p0 = *iter; + ++iter; + AuthProperty p1 = *iter; + iter++; + AuthProperty p2 = *iter; + EXPECT_EQ("name", p0.first); + EXPECT_EQ("chapi", p0.second); + EXPECT_EQ("name", p1.first); + EXPECT_EQ("chapo", p1.second); + EXPECT_EQ("foo", p2.first); + EXPECT_EQ("bar", p2.second); + ++iter; + EXPECT_EQ(empty_iter, iter); +} + +} // namespace +} // namespace grpc + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index a1819dc4d6..f18a04178e 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -48,6 +48,7 @@ TEST_F(SecureAuthContextTest, EmptyContext) { EXPECT_TRUE(context.GetPeerIdentityPropertyName().empty()); EXPECT_TRUE(context.FindPropertyValues("").empty()); EXPECT_TRUE(context.FindPropertyValues("whatever").empty()); + EXPECT_TRUE(context.begin() == context.end()); } TEST_F(SecureAuthContextTest, Properties) { @@ -68,6 +69,51 @@ TEST_F(SecureAuthContextTest, Properties) { EXPECT_EQ("bar", bar[0]); } +TEST_F(SecureAuthContextTest, Iterators) { + grpc_auth_context* ctx = grpc_auth_context_create(NULL, 3); + ctx->properties[0] = grpc_auth_property_init_from_cstring("name", "chapi"); + ctx->properties[1] = grpc_auth_property_init_from_cstring("name", "chapo"); + ctx->properties[2] = grpc_auth_property_init_from_cstring("foo", "bar"); + ctx->peer_identity_property_name = ctx->properties[0].name; + + SecureAuthContext context(ctx); + AuthPropertyIterator iter = context.begin(); + EXPECT_TRUE(context.end() != iter); + AuthProperty p0 = *iter; + ++iter; + AuthProperty p1 = *iter; + iter++; + AuthProperty p2 = *iter; + EXPECT_EQ("name", p0.first); + EXPECT_EQ("chapi", p0.second); + EXPECT_EQ("name", p1.first); + EXPECT_EQ("chapo", p1.second); + EXPECT_EQ("foo", p2.first); + EXPECT_EQ("bar", p2.second); + ++iter; + EXPECT_EQ(context.end(), iter); + // Range-based for loop test. + int i = 0; + for (auto p : context) { + switch (i++) { + case 0: + EXPECT_EQ("name", p.first); + EXPECT_EQ("chapi", p.second); + break; + case 1: + EXPECT_EQ("name", p.first); + EXPECT_EQ("chapo", p.second); + break; + case 2: + EXPECT_EQ("foo", p.first); + EXPECT_EQ("bar", p.second); + break; + default: + EXPECT_TRUE(0); + } + } +} + } // namespace } // namespace grpc diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 645226f375..906f124c05 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -31,13 +31,10 @@ * */ -#include <thread> - #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" -#include "src/cpp/server/thread_pool.h" #include <grpc++/channel_arguments.h> #include <grpc++/channel_interface.h> #include <grpc++/client_context.h> diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 207dad5282..4b27cfea21 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -35,7 +35,6 @@ #include <thread> #include "src/core/security/credentials.h" -#include "src/cpp/server/thread_pool.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.grpc.pb.h" @@ -46,6 +45,7 @@ #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> +#include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> @@ -260,7 +260,7 @@ class End2endTest : public ::testing::Test { TestServiceImpl service_; TestServiceImpl special_service_; TestServiceImplDupPkg dup_pkg_service_; - ThreadPool thread_pool_; + FixedSizeThreadPool thread_pool_; }; static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub, diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 59a8edf509..74b40d54d8 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -37,12 +37,12 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" -#include "src/cpp/server/thread_pool.h" #include <grpc++/channel_arguments.h> #include <grpc++/channel_interface.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> +#include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> @@ -260,7 +260,7 @@ class MockTest : public ::testing::Test { std::unique_ptr<Server> server_; std::ostringstream server_address_; TestServiceImpl service_; - ThreadPool thread_pool_; + FixedSizeThreadPool thread_pool_; }; // Do one real rpc and one mocked one diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 4d4d590bdd..d71345055d 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -31,13 +31,10 @@ * */ -#include <thread> - #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" -#include "src/cpp/server/thread_pool.h" #include <grpc++/channel_arguments.h> #include <grpc++/channel_interface.h> #include <grpc++/client_context.h> diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 0b4d942566..58e8ba394d 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -38,12 +38,12 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" -#include "src/cpp/server/thread_pool.h" #include <grpc++/channel_arguments.h> #include <grpc++/channel_interface.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> +#include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> @@ -206,7 +206,7 @@ class End2endTest : public ::testing::Test { const int kMaxMessageSize_; TestServiceImpl service_; TestServiceImplDupPkg dup_pkg_service_; - ThreadPool thread_pool_; + FixedSizeThreadPool thread_pool_; }; static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub, diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 65ce2e9c2a..96149c5e75 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -64,6 +64,7 @@ DEFINE_string(test_case, "large_unary", "ping_pong : full-duplex streaming; " "cancel_after_begin : cancel stream after starting it; " "cancel_after_first_response: cancel on first response; " + "timeout_on_sleeping_server: deadline exceeds on stream; " "service_account_creds : large_unary with service_account auth; " "compute_engine_creds: large_unary with compute engine auth; " "jwt_token_creds: large_unary with JWT token auth; " @@ -101,6 +102,8 @@ int main(int argc, char** argv) { client.DoCancelAfterBegin(); } else if (FLAGS_test_case == "cancel_after_first_response") { client.DoCancelAfterFirstResponse(); + } else if (FLAGS_test_case == "timeout_on_sleeping_server") { + client.DoTimeoutOnSleepingServer(); } else if (FLAGS_test_case == "service_account_creds") { grpc::string json_key = GetServiceAccountJsonKey(); client.DoServiceAccountCreds(json_key, FLAGS_oauth_scope); @@ -119,6 +122,7 @@ int main(int argc, char** argv) { client.DoPingPong(); client.DoCancelAfterBegin(); client.DoCancelAfterFirstResponse(); + client.DoTimeoutOnSleepingServer(); // service_account_creds and jwt_token_creds can only run with ssl. if (FLAGS_enable_ssl) { grpc::string json_key = GetServiceAccountJsonKey(); @@ -132,6 +136,7 @@ int main(int argc, char** argv) { "Unsupported test case %s. Valid options are all|empty_unary|" "large_unary|client_streaming|server_streaming|half_duplex|ping_pong|" "cancel_after_begin|cancel_after_first_response|" + "timeout_on_sleeping_server|" "service_account_creds|compute_engine_creds|jwt_token_creds", FLAGS_test_case.c_str()); ret = 1; diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index f08f90b139..d88eff759c 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -351,5 +351,26 @@ void InteropClient::DoCancelAfterFirstResponse() { gpr_log(GPR_INFO, "Canceling pingpong streaming done."); } +void InteropClient::DoTimeoutOnSleepingServer() { + gpr_log(GPR_INFO, "Sending Ping Pong streaming rpc with a short deadline..."); + std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_)); + + ClientContext context; + std::chrono::system_clock::time_point deadline = + std::chrono::system_clock::now() + std::chrono::milliseconds(1); + context.set_deadline(deadline); + std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, + StreamingOutputCallResponse>> + stream(stub->FullDuplexCall(&context)); + + StreamingOutputCallRequest request; + request.mutable_payload()->set_body(grpc::string(27182, '\0')); + stream->Write(request); + + Status s = stream->Finish(); + GPR_ASSERT(s.error_code() == StatusCode::DEADLINE_EXCEEDED); + gpr_log(GPR_INFO, "Pingpong streaming timeout done."); +} + } // namespace testing } // namespace grpc diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index d9c895dfd9..d02e583d94 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -59,6 +59,7 @@ class InteropClient { void DoResponseStreamingWithSlowConsumer(); void DoCancelAfterBegin(); void DoCancelAfterFirstResponse(); + void DoTimeoutOnSleepingServer(); // Auth tests. // username is a string containing the user email void DoJwtTokenCreds(const grpc::string& username); diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index 22b8910a24..db87872cf5 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -149,14 +149,12 @@ class TestServiceImpl : public TestService::Service { StreamingOutputCallResponse response; bool write_success = true; while (write_success && stream->Read(&request)) { - response.mutable_payload()->set_type(request.payload().type()); - if (request.response_parameters_size() == 0) { - return Status(grpc::StatusCode::INTERNAL, - "Request does not have response parameters."); + if (request.response_parameters_size() != 0) { + response.mutable_payload()->set_type(request.payload().type()); + response.mutable_payload()->set_body( + grpc::string(request.response_parameters(0).size(), '\0')); + write_success = stream->Write(response); } - response.mutable_payload()->set_body( - grpc::string(request.response_parameters(0).size(), '\0')); - write_success = stream->Write(response); } if (write_success) { return Status::OK; diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc index c2e750dcf7..30a78ffddf 100644 --- a/test/cpp/interop/server_helper.cc +++ b/test/cpp/interop/server_helper.cc @@ -58,5 +58,18 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() { } } +InteropContextInspector::InteropContextInspector( + const ::grpc::ServerContext& context) + : context_(context) {} + +std::shared_ptr<const AuthContext> InteropContextInspector::GetAuthContext() + const { + return context_.auth_context(); +} + +bool InteropContextInspector::IsCancelled() const { + return context_.IsCancelled(); +} + } // namespace testing } // namespace grpc diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h index f98e67bb67..ce977b4705 100644 --- a/test/cpp/interop/server_helper.h +++ b/test/cpp/interop/server_helper.h @@ -36,6 +36,7 @@ #include <memory> +#include <grpc++/server_context.h> #include <grpc++/server_credentials.h> namespace grpc { @@ -43,6 +44,18 @@ namespace testing { std::shared_ptr<ServerCredentials> CreateInteropServerCredentials(); +class InteropContextInspector { + public: + InteropContextInspector(const ::grpc::ServerContext& context); + + // Inspector methods, able to peek inside ServerContext, follow. + std::shared_ptr<const AuthContext> GetAuthContext() const; + bool IsCancelled() const; + + private: + const ::grpc::ServerContext& context_; +}; + } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index f5251e961b..be23204608 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -45,6 +45,7 @@ #include <grpc/support/host_port.h> #include <grpc++/async_unary_call.h> #include <grpc++/config.h> +#include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> @@ -52,7 +53,6 @@ #include <grpc++/status.h> #include <grpc++/stream.h> #include <gtest/gtest.h> -#include "src/cpp/server/thread_pool.h" #include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index bc00de9ced..d90ff2212b 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -40,13 +40,13 @@ #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc++/config.h> +#include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> #include <grpc++/server_credentials.h> #include <grpc++/status.h> #include <grpc++/stream.h> -#include "src/cpp/server/thread_pool.h" #include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/server.h" #include "test/cpp/qps/timer.h" @@ -111,7 +111,7 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server { } TestServiceImpl service_; - ThreadPool thread_pool_; + FixedSizeThreadPool thread_pool_; std::unique_ptr<grpc::Server> impl_; }; diff --git a/test/cpp/server/thread_pool_test.cc b/test/cpp/server/fixed_size_thread_pool_test.cc index 824d785316..d62f4e8132 100644 --- a/test/cpp/server/thread_pool_test.cc +++ b/test/cpp/server/fixed_size_thread_pool_test.cc @@ -35,17 +35,17 @@ #include <functional> #include <mutex> -#include "src/cpp/server/thread_pool.h" +#include <grpc++/fixed_size_thread_pool.h> #include <gtest/gtest.h> namespace grpc { -class ThreadPoolTest : public ::testing::Test { +class FixedSizeThreadPoolTest : public ::testing::Test { public: - ThreadPoolTest() : thread_pool_(4) {} + FixedSizeThreadPoolTest() : thread_pool_(4) {} protected: - ThreadPool thread_pool_; + FixedSizeThreadPool thread_pool_; }; void Callback(std::mutex* mu, std::condition_variable* cv, bool* done) { @@ -54,7 +54,7 @@ void Callback(std::mutex* mu, std::condition_variable* cv, bool* done) { cv->notify_all(); } -TEST_F(ThreadPoolTest, ScheduleCallback) { +TEST_F(FixedSizeThreadPoolTest, ScheduleCallback) { std::mutex mu; std::condition_variable cv; bool done = false; diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 6cf86ea89b..00bb821ae6 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -34,12 +34,12 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/cli_call.h" #include "test/cpp/util/echo.grpc.pb.h" -#include "src/cpp/server/thread_pool.h" #include <grpc++/channel_arguments.h> #include <grpc++/channel_interface.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> +#include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> @@ -102,7 +102,7 @@ class CliCallTest : public ::testing::Test { std::unique_ptr<Server> server_; std::ostringstream server_address_; TestServiceImpl service_; - ThreadPool thread_pool_; + FixedSizeThreadPool thread_pool_; }; // Send a rpc with a normal stub and then a CliCall. Verify they match. |