diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/core/echo/server.c | 4 | ||||
-rw-r--r-- | test/core/end2end/fixtures/chttp2_fake_security.c | 4 | ||||
-rw-r--r-- | test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c | 4 | ||||
-rw-r--r-- | test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c | 4 | ||||
-rw-r--r-- | test/core/fling/server.c | 4 | ||||
-rw-r--r-- | test/core/surface/lame_client_test.c | 2 | ||||
-rw-r--r-- | test/cpp/client/credentials_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/end2end/async_end2end_test.cc | 7 | ||||
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 14 | ||||
-rw-r--r-- | test/cpp/interop/client.cc | 17 | ||||
-rw-r--r-- | test/cpp/interop/server.cc | 12 | ||||
-rw-r--r-- | test/cpp/qps/driver.cc | 6 | ||||
-rw-r--r-- | test/cpp/qps/server.cc | 172 | ||||
-rw-r--r-- | test/cpp/qps/server_async.cc | 3 | ||||
-rw-r--r-- | test/cpp/qps/server_sync.cc | 3 | ||||
-rw-r--r-- | test/cpp/qps/worker.cc | 3 | ||||
-rw-r--r-- | test/cpp/util/create_test_channel.cc | 10 |
17 files changed, 222 insertions, 50 deletions
diff --git a/test/core/echo/server.c b/test/core/echo/server.c index bc84645a04..e888a0c877 100644 --- a/test/core/echo/server.c +++ b/test/core/echo/server.c @@ -143,8 +143,8 @@ int main(int argc, char **argv) { test_server1_cert}; grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1); - server = grpc_secure_server_create(ssl_creds, cq, &args); - GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr)); + server = grpc_server_create(cq, &args); + GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); grpc_server_credentials_release(ssl_creds); } else { server = grpc_server_create(cq, &args); diff --git a/test/core/end2end/fixtures/chttp2_fake_security.c b/test/core/end2end/fixtures/chttp2_fake_security.c index 247d1fd322..047d482be3 100644 --- a/test/core/end2end/fixtures/chttp2_fake_security.c +++ b/test/core/end2end/fixtures/chttp2_fake_security.c @@ -84,9 +84,9 @@ static void chttp2_init_server_secure_fullstack( grpc_server_destroy(f->server); } f->server = - grpc_secure_server_create(server_creds, f->server_cq, server_args); + grpc_server_create(f->server_cq, server_args); + GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); - GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c index 3df2e40806..16433f5f87 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c @@ -87,9 +87,9 @@ static void chttp2_init_server_secure_fullstack( grpc_server_destroy(f->server); } f->server = - grpc_secure_server_create(server_creds, f->server_cq, server_args); + grpc_server_create(f->server_cq, server_args); + GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); - GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c index 8d6c561d25..99031df8e5 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c @@ -85,9 +85,9 @@ static void chttp2_init_server_secure_fullstack( grpc_server_destroy(f->server); } f->server = - grpc_secure_server_create(server_creds, f->server_cq, server_args); + grpc_server_create(f->server_cq, server_args); + GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); - GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 5c1ab14d03..ca39cd84b1 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -205,8 +205,8 @@ int main(int argc, char **argv) { test_server1_cert}; grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1); - server = grpc_secure_server_create(ssl_creds, cq, NULL); - GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr)); + server = grpc_server_create(cq, NULL); + GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); grpc_server_credentials_release(ssl_creds); } else { server = grpc_server_create(cq, NULL); diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 3653c5a1b0..f0420896ee 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -31,7 +31,7 @@ * */ -#include "src/core/surface/lame_client.h" +#include <grpc/grpc.h> #include "test/core/end2end/cq_verifier.h" #include "test/core/util/test_config.h" diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index dc8d76d7ef..59ca33cc29 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -47,8 +47,7 @@ class CredentialsTest : public ::testing::Test { TEST_F(CredentialsTest, InvalidServiceAccountCreds) { std::unique_ptr<Credentials> bad1 = - CredentialsFactory::ServiceAccountCredentials("", "", - std::chrono::seconds(1)); + ServiceAccountCredentials("", "", std::chrono::seconds(1)); EXPECT_EQ(nullptr, bad1.get()); } diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 331a5ef8a0..70df9e14b2 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -47,6 +47,7 @@ #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 "test/core/util/port.h" @@ -84,7 +85,7 @@ class AsyncEnd2endTest : public ::testing::Test { server_address_ << "localhost:" << port; // Setup server ServerBuilder builder; - builder.AddPort(server_address_.str()); + builder.AddPort(server_address_.str(), grpc::InsecureServerCredentials()); builder.RegisterAsyncService(&service_); server_ = builder.BuildAndStart(); } @@ -102,8 +103,8 @@ class AsyncEnd2endTest : public ::testing::Test { } void ResetStub() { - std::shared_ptr<ChannelInterface> channel = - CreateChannelDeprecated(server_address_.str(), ChannelArguments()); + std::shared_ptr<ChannelInterface> channel = CreateChannel( + server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 1d5dfc4e34..c586849349 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -47,6 +47,7 @@ #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 "test/core/util/port.h" @@ -150,7 +151,7 @@ class End2endTest : public ::testing::Test { server_address_ << "localhost:" << port; // Setup server ServerBuilder builder; - builder.AddPort(server_address_.str()); + builder.AddPort(server_address_.str(), InsecureServerCredentials()); builder.RegisterService(&service_); builder.RegisterService(&dup_pkg_service_); builder.SetThreadPool(&thread_pool_); @@ -160,8 +161,8 @@ class End2endTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr<ChannelInterface> channel = - CreateChannelDeprecated(server_address_.str(), ChannelArguments()); + std::shared_ptr<ChannelInterface> channel = CreateChannel( + server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } @@ -371,8 +372,8 @@ TEST_F(End2endTest, BidiStream) { // Talk to the two services with the same name but different package names. // The two stubs are created on the same channel. TEST_F(End2endTest, DiffPackageServices) { - std::shared_ptr<ChannelInterface> channel = - CreateChannelDeprecated(server_address_.str(), ChannelArguments()); + std::shared_ptr<ChannelInterface> channel = CreateChannel( + server_address_.str(), InsecureCredentials(), ChannelArguments()); EchoRequest request; EchoResponse response; @@ -397,8 +398,7 @@ TEST_F(End2endTest, DiffPackageServices) { // rpc and stream should fail on bad credentials. TEST_F(End2endTest, BadCredentials) { std::unique_ptr<Credentials> bad_creds = - CredentialsFactory::ServiceAccountCredentials("", "", - std::chrono::seconds(1)); + ServiceAccountCredentials("", "", std::chrono::seconds(1)); EXPECT_EQ(nullptr, bad_creds.get()); std::shared_ptr<ChannelInterface> channel = CreateChannel(server_address_.str(), bad_creds, ChannelArguments()); diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index f7537c2d7b..ae68f7a556 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -82,9 +82,10 @@ DEFINE_string(oauth_scope, "", "Scope for OAuth tokens."); using grpc::ChannelInterface; using grpc::ClientContext; +using grpc::ComputeEngineCredentials; using grpc::CreateTestChannel; using grpc::Credentials; -using grpc::CredentialsFactory; +using grpc::ServiceAccountCredentials; using grpc::testing::ResponseParameters; using grpc::testing::SimpleRequest; using grpc::testing::SimpleResponse; @@ -96,8 +97,8 @@ using grpc::testing::TestService; // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. -namespace google { } -namespace gflags { } +namespace google {} +namespace gflags {} using namespace google; using namespace gflags; @@ -135,14 +136,14 @@ std::shared_ptr<ChannelInterface> CreateChannelForTestCase( std::unique_ptr<Credentials> creds; GPR_ASSERT(FLAGS_enable_ssl); grpc::string json_key = GetServiceAccountJsonKey(); - creds = CredentialsFactory::ServiceAccountCredentials( - json_key, FLAGS_oauth_scope, std::chrono::hours(1)); + creds = ServiceAccountCredentials(json_key, FLAGS_oauth_scope, + std::chrono::hours(1)); return CreateTestChannel(host_port, FLAGS_server_host_override, FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); } else if (test_case == "compute_engine_creds") { std::unique_ptr<Credentials> creds; GPR_ASSERT(FLAGS_enable_ssl); - creds = CredentialsFactory::ComputeEngineCredentials(); + creds = ComputeEngineCredentials(); return CreateTestChannel(host_port, FLAGS_server_host_override, FLAGS_enable_ssl, FLAGS_use_prod_roots, creds); } else { @@ -202,7 +203,7 @@ void DoComputeEngineCreds() { GPR_ASSERT(!response.username().empty()); GPR_ASSERT(response.username().c_str() == FLAGS_default_service_account); GPR_ASSERT(!response.oauth_scope().empty()); - const char *oauth_scope_str = response.oauth_scope().c_str(); + const char* oauth_scope_str = response.oauth_scope().c_str(); GPR_ASSERT(FLAGS_oauth_scope.find(oauth_scope_str) != grpc::string::npos); gpr_log(GPR_INFO, "Large unary with compute engine creds done."); } @@ -221,7 +222,7 @@ void DoServiceAccountCreds() { GPR_ASSERT(!response.oauth_scope().empty()); grpc::string json_key = GetServiceAccountJsonKey(); GPR_ASSERT(json_key.find(response.username()) != grpc::string::npos); - const char *oauth_scope_str = response.oauth_scope().c_str(); + const char* oauth_scope_str = response.oauth_scope().c_str(); GPR_ASSERT(FLAGS_oauth_scope.find(oauth_scope_str) != grpc::string::npos); gpr_log(GPR_INFO, "Large unary with service account creds done."); } diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index 9810ff6622..743482e967 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -60,7 +60,6 @@ using grpc::Server; using grpc::ServerBuilder; using grpc::ServerContext; using grpc::ServerCredentials; -using grpc::ServerCredentialsFactory; using grpc::ServerReader; using grpc::ServerReaderWriter; using grpc::ServerWriter; @@ -78,8 +77,8 @@ using grpc::Status; // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. -namespace google { } -namespace gflags { } +namespace google {} +namespace gflags {} using namespace google; using namespace gflags; @@ -211,15 +210,14 @@ void RunServer() { SimpleResponse response; ServerBuilder builder; - builder.AddPort(server_address.str()); builder.RegisterService(&service); + std::shared_ptr<ServerCredentials> creds = grpc::InsecureServerCredentials(); if (FLAGS_enable_ssl) { SslServerCredentialsOptions ssl_opts = { "", {{test_server1_key, test_server1_cert}}}; - std::shared_ptr<ServerCredentials> creds = - ServerCredentialsFactory::SslCredentials(ssl_opts); - builder.SetCredentials(creds); + creds = grpc::SslServerCredentials(ssl_opts); } + builder.AddPort(server_address.str(), creds); std::unique_ptr<Server> server(builder.BuildAndStart()); gpr_log(GPR_INFO, "Server listening on %s", server_address.str().c_str()); while (!got_sigint) { diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 6d5df799a2..d29ca1de94 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -103,7 +103,7 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, for (size_t i = 0; i < num_servers; i++) { ServerData sd; sd.stub = std::move(Worker::NewStub( - CreateChannelDeprecated(workers[i], ChannelArguments()))); + CreateChannel(workers[i], InsecureCredentials(), ChannelArguments()))); ServerArgs args; *args.mutable_setup() = server_config; sd.stream = std::move(sd.stub->RunServer(alloc_context())); @@ -131,8 +131,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config, vector<ClientData> clients; for (size_t i = 0; i < num_clients; i++) { ClientData cd; - cd.stub = std::move(Worker::NewStub( - CreateChannelDeprecated(workers[i + num_servers], ChannelArguments()))); + cd.stub = std::move(Worker::NewStub(CreateChannel( + workers[i + num_servers], InsecureCredentials(), ChannelArguments()))); ClientArgs args; *args.mutable_setup() = client_config; cd.stream = std::move(cd.stub->RunTest(alloc_context())); diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc new file mode 100644 index 0000000000..005f0f9c5e --- /dev/null +++ b/test/cpp/qps/server.cc @@ -0,0 +1,172 @@ +/* + * + * 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 <sys/time.h> +#include <sys/resource.h> +#include <sys/signal.h> +#include <thread> + +#include <unistd.h> + +#include <gflags/gflags.h> +#include <grpc/support/alloc.h> +#include <grpc/support/host_port.h> +#include <grpc++/config.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 "src/cpp/server/thread_pool.h" +#include "test/core/util/grpc_profiler.h" +#include "test/cpp/qps/qpstest.pb.h" + +#include <grpc/grpc.h> +#include <grpc/support/log.h> + +DEFINE_bool(enable_ssl, false, "Whether to use ssl/tls."); +DEFINE_int32(port, 0, "Server port."); +DEFINE_int32(server_threads, 4, "Number of server threads."); + +using grpc::Server; +using grpc::ServerBuilder; +using grpc::ServerContext; +using grpc::ThreadPool; +using grpc::testing::Payload; +using grpc::testing::PayloadType; +using grpc::testing::ServerStats; +using grpc::testing::SimpleRequest; +using grpc::testing::SimpleResponse; +using grpc::testing::StatsRequest; +using grpc::testing::TestService; +using grpc::Status; + +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google { } +namespace gflags { } +using namespace google; +using namespace gflags; + +static bool got_sigint = false; + +static void sigint_handler(int x) { got_sigint = 1; } + +static double time_double(struct timeval* tv) { + return tv->tv_sec + 1e-6 * tv->tv_usec; +} + +static bool SetPayload(PayloadType type, int size, Payload* payload) { + PayloadType response_type = type; + // TODO(yangg): Support UNCOMPRESSABLE payload. + if (type != PayloadType::COMPRESSABLE) { + return false; + } + payload->set_type(response_type); + std::unique_ptr<char[]> body(new char[size]()); + payload->set_body(body.get(), size); + return true; +} + +namespace { + +class TestServiceImpl GRPC_FINAL : public TestService::Service { + public: + Status CollectServerStats(ServerContext* context, const StatsRequest*, + ServerStats* response) { + struct rusage usage; + struct timeval tv; + gettimeofday(&tv, NULL); + getrusage(RUSAGE_SELF, &usage); + response->set_time_now(time_double(&tv)); + response->set_time_user(time_double(&usage.ru_utime)); + response->set_time_system(time_double(&usage.ru_stime)); + return Status::OK; + } + Status UnaryCall(ServerContext* context, const SimpleRequest* request, + SimpleResponse* response) { + if (request->has_response_size() && request->response_size() > 0) { + if (!SetPayload(request->response_type(), request->response_size(), + response->mutable_payload())) { + return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); + } + } + return Status::OK; + } +}; + +} // namespace + +static void RunServer() { + char* server_address = NULL; + gpr_join_host_port(&server_address, "::", FLAGS_port); + + TestServiceImpl service; + + SimpleRequest request; + SimpleResponse response; + + ServerBuilder builder; + builder.AddPort(server_address, grpc::InsecureServerCredentials()); + builder.RegisterService(&service); + + std::unique_ptr<ThreadPool> pool(new ThreadPool(FLAGS_server_threads)); + builder.SetThreadPool(pool.get()); + + std::unique_ptr<Server> server(builder.BuildAndStart()); + gpr_log(GPR_INFO, "Server listening on %s\n", server_address); + + grpc_profiler_start("qps_server.prof"); + + while (!got_sigint) { + sleep(5); + } + + grpc_profiler_stop(); + + gpr_free(server_address); +} + +int main(int argc, char** argv) { + grpc_init(); + ParseCommandLineFlags(&argc, &argv, true); + + signal(SIGINT, sigint_handler); + + GPR_ASSERT(FLAGS_port != 0); + GPR_ASSERT(!FLAGS_enable_ssl); + RunServer(); + + grpc_shutdown(); + return 0; +} diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 64aca957e4..19778e5a7c 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -46,6 +46,7 @@ #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> +#include <grpc++/server_credentials.h> #include <grpc++/status.h> #include <gtest/gtest.h> #include "src/cpp/server/thread_pool.h" @@ -67,7 +68,7 @@ class AsyncQpsServerTest : public Server { gpr_join_host_port(&server_address, "::", port); ServerBuilder builder; - builder.AddPort(server_address); + builder.AddPort(server_address, InsecureServerCredentials()); gpr_free(server_address); builder.RegisterAsyncService(&async_service_); diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index beee688608..5c6541989c 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -43,6 +43,7 @@ #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" @@ -83,7 +84,7 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server { char* server_address = NULL; gpr_join_host_port(&server_address, "::", port); - builder.AddPort(server_address); + builder.AddPort(server_address, InsecureServerCredentials()); gpr_free(server_address); builder.RegisterService(&service_); diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index 3a46a22665..faabfd1147 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -51,6 +51,7 @@ #include <grpc++/status.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> +#include <grpc++/server_credentials.h> #include <grpc++/stream.h> #include "test/core/util/grpc_profiler.h" #include "test/cpp/util/create_test_channel.h" @@ -209,7 +210,7 @@ static void RunServer() { WorkerImpl service; ServerBuilder builder; - builder.AddPort(server_address); + builder.AddPort(server_address, InsecureServerCredentials()); builder.RegisterService(&service); gpr_free(server_address); diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index 745496f463..d3b84b2965 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -61,12 +61,10 @@ std::shared_ptr<ChannelInterface> CreateTestChannel( const std::unique_ptr<Credentials>& creds) { ChannelArguments channel_args; if (enable_ssl) { - const char* roots_certs = - use_prod_roots ? "" : test_root_cert; + const char* roots_certs = use_prod_roots ? "" : test_root_cert; SslCredentialsOptions ssl_opts = {roots_certs, "", ""}; - std::unique_ptr<Credentials> channel_creds = - CredentialsFactory::SslCredentials(ssl_opts); + std::unique_ptr<Credentials> channel_creds = SslCredentials(ssl_opts); if (!server.empty() && !override_hostname.empty()) { channel_args.SetSslTargetNameOverride(override_hostname); @@ -75,11 +73,11 @@ std::shared_ptr<ChannelInterface> CreateTestChannel( server.empty() ? override_hostname : server; if (creds.get()) { channel_creds = - CredentialsFactory::CompositeCredentials(creds, channel_creds); + CompositeCredentials(creds, channel_creds); } return CreateChannel(connect_to, channel_creds, channel_args); } else { - return CreateChannelDeprecated(server, channel_args); + return CreateChannel(server, InsecureCredentials(), channel_args); } } |