diff options
author | dvshkurko <dvshkurko@yandex-team.ru> | 2022-02-10 16:45:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:51 +0300 |
commit | 321ee9bce31ec6e238be26dbcbe539cffa2c3309 (patch) | |
tree | 14407a2757cbf29eb97e266b7f07e851f971000c /contrib/libs/grpc/test/cpp/util | |
parent | 2f6ca198245aeffd5e2d82b65927c2465b68b4f5 (diff) | |
download | ydb-321ee9bce31ec6e238be26dbcbe539cffa2c3309.tar.gz |
Restoring authorship annotation for <dvshkurko@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/grpc/test/cpp/util')
16 files changed, 205 insertions, 205 deletions
diff --git a/contrib/libs/grpc/test/cpp/util/byte_buffer_test.cc b/contrib/libs/grpc/test/cpp/util/byte_buffer_test.cc index c63f351a8f..2354b46f51 100644 --- a/contrib/libs/grpc/test/cpp/util/byte_buffer_test.cc +++ b/contrib/libs/grpc/test/cpp/util/byte_buffer_test.cc @@ -38,13 +38,13 @@ namespace { const char* kContent1 = "hello xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world"; -class ByteBufferTest : public ::testing::Test { - protected: - static void SetUpTestCase() { grpc_init(); } - - static void TearDownTestCase() { grpc_shutdown(); } -}; +class ByteBufferTest : public ::testing::Test { + protected: + static void SetUpTestCase() { grpc_init(); } + static void TearDownTestCase() { grpc_shutdown(); } +}; + TEST_F(ByteBufferTest, CopyCtor) { ByteBuffer buffer1; EXPECT_FALSE(buffer1.Valid()); diff --git a/contrib/libs/grpc/test/cpp/util/cli_call.h b/contrib/libs/grpc/test/cpp/util/cli_call.h index 79d00d99f4..5284b00084 100644 --- a/contrib/libs/grpc/test/cpp/util/cli_call.h +++ b/contrib/libs/grpc/test/cpp/util/cli_call.h @@ -27,7 +27,7 @@ #include <map> -namespace grpc { +namespace grpc { class ClientContext; diff --git a/contrib/libs/grpc/test/cpp/util/cli_call_test.cc b/contrib/libs/grpc/test/cpp/util/cli_call_test.cc index 4f0544b2e5..e99c6a28b9 100644 --- a/contrib/libs/grpc/test/cpp/util/cli_call_test.cc +++ b/contrib/libs/grpc/test/cpp/util/cli_call_test.cc @@ -74,8 +74,8 @@ class CliCallTest : public ::testing::Test { void TearDown() override { server_->Shutdown(); } void ResetStub() { - channel_ = grpc::CreateChannel(server_address_.str(), - InsecureChannelCredentials()); + channel_ = grpc::CreateChannel(server_address_.str(), + InsecureChannelCredentials()); stub_ = grpc::testing::EchoTestService::NewStub(channel_); } diff --git a/contrib/libs/grpc/test/cpp/util/cli_credentials.cc b/contrib/libs/grpc/test/cpp/util/cli_credentials.cc index efd548eb9b..e7127f9296 100644 --- a/contrib/libs/grpc/test/cpp/util/cli_credentials.cc +++ b/contrib/libs/grpc/test/cpp/util/cli_credentials.cc @@ -41,11 +41,11 @@ DEFINE_string( "validation."); DEFINE_string( ssl_client_cert, "", - "If not empty, load this PEM formatted client certificate file. Requires " + "If not empty, load this PEM formatted client certificate file. Requires " "use of --ssl_client_key."); DEFINE_string( ssl_client_key, "", - "If not empty, load this PEM formatted private key. Requires use of " + "If not empty, load this PEM formatted private key. Requires use of " "--ssl_client_cert"); DEFINE_string( local_connect_type, "local_tcp", diff --git a/contrib/libs/grpc/test/cpp/util/create_test_channel.cc b/contrib/libs/grpc/test/cpp/util/create_test_channel.cc index 86d8e22af1..d660428537 100644 --- a/contrib/libs/grpc/test/cpp/util/create_test_channel.cc +++ b/contrib/libs/grpc/test/cpp/util/create_test_channel.cc @@ -42,8 +42,8 @@ const char kProdTlsCredentialsType[] = "prod_ssl"; class SslCredentialProvider : public testing::CredentialTypeProvider { public: std::shared_ptr<ChannelCredentials> GetChannelCredentials( - grpc::ChannelArguments* /*args*/) override { - return grpc::SslCredentials(SslCredentialsOptions()); + grpc::ChannelArguments* /*args*/) override { + return grpc::SslCredentials(SslCredentialsOptions()); } std::shared_ptr<ServerCredentials> GetServerCredentials() override { return nullptr; @@ -90,76 +90,76 @@ std::shared_ptr<Channel> CreateTestChannel( const TString& override_hostname, bool use_prod_roots, const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args) { - return CreateTestChannel(server, cred_type, override_hostname, use_prod_roots, - creds, args, - /*interceptor_creators=*/{}); -} - -std::shared_ptr<Channel> CreateTestChannel( + return CreateTestChannel(server, cred_type, override_hostname, use_prod_roots, + creds, args, + /*interceptor_creators=*/{}); +} + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& override_hostname, - testing::transport_security security_type, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds, - const ChannelArguments& args) { - return CreateTestChannel(server, override_hostname, security_type, - use_prod_roots, creds, args, - /*interceptor_creators=*/{}); -} - -std::shared_ptr<Channel> CreateTestChannel( + testing::transport_security security_type, bool use_prod_roots, + const std::shared_ptr<CallCredentials>& creds, + const ChannelArguments& args) { + return CreateTestChannel(server, override_hostname, security_type, + use_prod_roots, creds, args, + /*interceptor_creators=*/{}); +} + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& override_hostname, - testing::transport_security security_type, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds) { - return CreateTestChannel(server, override_hostname, security_type, - use_prod_roots, creds, ChannelArguments()); -} - -std::shared_ptr<Channel> CreateTestChannel( + testing::transport_security security_type, bool use_prod_roots, + const std::shared_ptr<CallCredentials>& creds) { + return CreateTestChannel(server, override_hostname, security_type, + use_prod_roots, creds, ChannelArguments()); +} + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& override_hostname, - testing::transport_security security_type, bool use_prod_roots) { - return CreateTestChannel(server, override_hostname, security_type, - use_prod_roots, std::shared_ptr<CallCredentials>()); -} - -// Shortcut for end2end and interop tests. -std::shared_ptr<Channel> CreateTestChannel( + testing::transport_security security_type, bool use_prod_roots) { + return CreateTestChannel(server, override_hostname, security_type, + use_prod_roots, std::shared_ptr<CallCredentials>()); +} + +// Shortcut for end2end and interop tests. +std::shared_ptr<Channel> CreateTestChannel( const TString& server, testing::transport_security security_type) { - return CreateTestChannel(server, "foo.test.google.fr", security_type, false); -} - -std::shared_ptr<Channel> CreateTestChannel( + return CreateTestChannel(server, "foo.test.google.fr", security_type, false); +} + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& credential_type, - const std::shared_ptr<CallCredentials>& creds) { - ChannelArguments channel_args; + const std::shared_ptr<CallCredentials>& creds) { + ChannelArguments channel_args; MaybeSetCustomChannelArgs(&channel_args); - std::shared_ptr<ChannelCredentials> channel_creds = - testing::GetCredentialsProvider()->GetChannelCredentials(credential_type, - &channel_args); - GPR_ASSERT(channel_creds != nullptr); - if (creds.get()) { - channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); - } - return ::grpc::CreateCustomChannel(server, channel_creds, channel_args); -} - -std::shared_ptr<Channel> CreateTestChannel( + std::shared_ptr<ChannelCredentials> channel_creds = + testing::GetCredentialsProvider()->GetChannelCredentials(credential_type, + &channel_args); + GPR_ASSERT(channel_creds != nullptr); + if (creds.get()) { + channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); + } + return ::grpc::CreateCustomChannel(server, channel_creds, channel_args); +} + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& cred_type, const TString& override_hostname, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators) { + const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators) { ChannelArguments channel_args(args); MaybeSetCustomChannelArgs(&channel_args); std::shared_ptr<ChannelCredentials> channel_creds; if (cred_type.empty()) { - if (interceptor_creators.empty()) { - return ::grpc::CreateCustomChannel(server, InsecureChannelCredentials(), + if (interceptor_creators.empty()) { + return ::grpc::CreateCustomChannel(server, InsecureChannelCredentials(), channel_args); - } else { - return experimental::CreateCustomChannelWithInterceptors( + } else { + return experimental::CreateCustomChannelWithInterceptors( server, InsecureChannelCredentials(), channel_args, - std::move(interceptor_creators)); - } + std::move(interceptor_creators)); + } } else if (cred_type == testing::kTlsCredentialsType) { // cred_type == "ssl" if (use_prod_roots) { gpr_once_init(&g_once_init_add_prod_ssl_provider, &AddProdSslType); @@ -177,65 +177,65 @@ std::shared_ptr<Channel> CreateTestChannel( const TString& connect_to = server.empty() ? override_hostname : server; if (creds.get()) { - channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); - } - if (interceptor_creators.empty()) { - return ::grpc::CreateCustomChannel(connect_to, channel_creds, - channel_args); - } else { - return experimental::CreateCustomChannelWithInterceptors( - connect_to, channel_creds, channel_args, - std::move(interceptor_creators)); + channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); } + if (interceptor_creators.empty()) { + return ::grpc::CreateCustomChannel(connect_to, channel_creds, + channel_args); + } else { + return experimental::CreateCustomChannelWithInterceptors( + connect_to, channel_creds, channel_args, + std::move(interceptor_creators)); + } } else { channel_creds = testing::GetCredentialsProvider()->GetChannelCredentials( cred_type, &channel_args); GPR_ASSERT(channel_creds != nullptr); - if (interceptor_creators.empty()) { + if (interceptor_creators.empty()) { return ::grpc::CreateCustomChannel(server, channel_creds, channel_args); - } else { - return experimental::CreateCustomChannelWithInterceptors( + } else { + return experimental::CreateCustomChannelWithInterceptors( server, channel_creds, channel_args, std::move(interceptor_creators)); - } + } } } std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& override_hostname, testing::transport_security security_type, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators) { + const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators) { TString credential_type = security_type == testing::ALTS ? testing::kAltsCredentialsType : (security_type == testing::TLS ? testing::kTlsCredentialsType : testing::kInsecureCredentialsType); - return CreateTestChannel(server, credential_type, override_hostname, - use_prod_roots, creds, args, - std::move(interceptor_creators)); + return CreateTestChannel(server, credential_type, override_hostname, + use_prod_roots, creds, args, + std::move(interceptor_creators)); } std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& override_hostname, testing::transport_security security_type, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators) { + const std::shared_ptr<CallCredentials>& creds, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators) { return CreateTestChannel(server, override_hostname, security_type, - use_prod_roots, creds, ChannelArguments(), - std::move(interceptor_creators)); + use_prod_roots, creds, ChannelArguments(), + std::move(interceptor_creators)); } std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& credential_type, - const std::shared_ptr<CallCredentials>& creds, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators) { + const std::shared_ptr<CallCredentials>& creds, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators) { ChannelArguments channel_args; MaybeSetCustomChannelArgs(&channel_args); std::shared_ptr<ChannelCredentials> channel_creds = @@ -243,10 +243,10 @@ std::shared_ptr<Channel> CreateTestChannel( &channel_args); GPR_ASSERT(channel_creds != nullptr); if (creds.get()) { - channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); + channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); } - return experimental::CreateCustomChannelWithInterceptors( - server, channel_creds, channel_args, std::move(interceptor_creators)); + return experimental::CreateCustomChannelWithInterceptors( + server, channel_creds, channel_args, std::move(interceptor_creators)); } } // namespace grpc diff --git a/contrib/libs/grpc/test/cpp/util/create_test_channel.h b/contrib/libs/grpc/test/cpp/util/create_test_channel.h index ed4ce6c11b..9ce9ca7fc5 100644 --- a/contrib/libs/grpc/test/cpp/util/create_test_channel.h +++ b/contrib/libs/grpc/test/cpp/util/create_test_channel.h @@ -21,10 +21,10 @@ #include <memory> -#include <grpcpp/channel.h> -#include <grpcpp/impl/codegen/client_interceptor.h> +#include <grpcpp/channel.h> +#include <grpcpp/impl/codegen/client_interceptor.h> #include <grpcpp/security/credentials.h> -#include <grpcpp/support/channel_arguments.h> +#include <grpcpp/support/channel_arguments.h> namespace grpc { class Channel; @@ -63,37 +63,37 @@ std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& credential_type, const std::shared_ptr<CallCredentials>& creds); -std::shared_ptr<Channel> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& override_hostname, - testing::transport_security security_type, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators); - -std::shared_ptr<Channel> CreateTestChannel( + testing::transport_security security_type, bool use_prod_roots, + const std::shared_ptr<CallCredentials>& creds, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators); + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& override_hostname, - testing::transport_security security_type, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators); - -std::shared_ptr<Channel> CreateTestChannel( + testing::transport_security security_type, bool use_prod_roots, + const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators); + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& cred_type, const TString& override_hostname, bool use_prod_roots, - const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators); - -std::shared_ptr<Channel> CreateTestChannel( + const std::shared_ptr<CallCredentials>& creds, const ChannelArguments& args, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators); + +std::shared_ptr<Channel> CreateTestChannel( const TString& server, const TString& credential_type, - const std::shared_ptr<CallCredentials>& creds, - std::vector< - std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> - interceptor_creators); - + const std::shared_ptr<CallCredentials>& creds, + std::vector< + std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> + interceptor_creators); + } // namespace grpc #endif // GRPC_TEST_CPP_UTIL_CREATE_TEST_CHANNEL_H diff --git a/contrib/libs/grpc/test/cpp/util/grpc_tool.cc b/contrib/libs/grpc/test/cpp/util/grpc_tool.cc index 30f3024e25..850ff70803 100644 --- a/contrib/libs/grpc/test/cpp/util/grpc_tool.cc +++ b/contrib/libs/grpc/test/cpp/util/grpc_tool.cc @@ -233,8 +233,8 @@ std::shared_ptr<grpc::Channel> CreateCliChannel( args.SetString(GRPC_ARG_SERVICE_CONFIG, FLAGS_default_service_config.c_str()); } - return ::grpc::CreateCustomChannel(server_address, cred.GetCredentials(), - args); + return ::grpc::CreateCustomChannel(server_address, cred.GetCredentials(), + args); } struct Command { @@ -443,7 +443,7 @@ bool GrpcTool::ListServices(int argc, const char** argv, return callback(output); } -bool GrpcTool::PrintType(int /*argc*/, const char** argv, +bool GrpcTool::PrintType(int /*argc*/, const char** argv, const CliCredentials& cred, GrpcToolOutputCallback callback) { CommandUsage( @@ -485,8 +485,8 @@ bool GrpcTool::CallMethod(int argc, const char** argv, " fallback when parsing request/response\n" " --proto_path ; The search path of proto files, valid" " only when --protofiles is given\n" - " --noremotedb ; Don't attempt to use reflection service" - " at all\n" + " --noremotedb ; Don't attempt to use reflection service" + " at all\n" " --metadata ; The metadata to be sent to the server\n" " --infile ; Input filename (defaults to stdin)\n" " --outfile ; Output filename (defaults to stdout)\n" @@ -618,7 +618,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv, call.WritesDoneAndWait(); read_thread.join(); - gpr_mu_destroy(&parser_mu); + gpr_mu_destroy(&parser_mu); std::multimap<grpc::string_ref, grpc::string_ref> server_trailing_metadata; Status status = call.Finish(&server_trailing_metadata); @@ -847,8 +847,8 @@ bool GrpcTool::ParseMessage(int argc, const char** argv, " fallback when parsing request/response\n" " --proto_path ; The search path of proto files, valid" " only when --protofiles is given\n" - " --noremotedb ; Don't attempt to use reflection service" - " at all\n" + " --noremotedb ; Don't attempt to use reflection service" + " at all\n" " --infile ; Input filename (defaults to stdin)\n" " --outfile ; Output filename (defaults to stdout)\n" " --binary_input ; Input in binary format\n" diff --git a/contrib/libs/grpc/test/cpp/util/grpc_tool_test.cc b/contrib/libs/grpc/test/cpp/util/grpc_tool_test.cc index ff610daadd..ebabc74772 100644 --- a/contrib/libs/grpc/test/cpp/util/grpc_tool_test.cc +++ b/contrib/libs/grpc/test/cpp/util/grpc_tool_test.cc @@ -471,9 +471,9 @@ TEST_F(GrpcToolTest, TypeNotFound) { const char* argv[] = {"grpc_cli", "type", server_address.c_str(), "grpc.testing.DummyRequest"}; - EXPECT_TRUE(1 == GrpcToolMainLib(ArraySize(argv), argv, TestCliCredentials(), - std::bind(PrintStream, &output_stream, - std::placeholders::_1))); + EXPECT_TRUE(1 == GrpcToolMainLib(ArraySize(argv), argv, TestCliCredentials(), + std::bind(PrintStream, &output_stream, + std::placeholders::_1))); ShutdownServer(); } diff --git a/contrib/libs/grpc/test/cpp/util/metrics_server.cc b/contrib/libs/grpc/test/cpp/util/metrics_server.cc index 0493da053e..69a17cf384 100644 --- a/contrib/libs/grpc/test/cpp/util/metrics_server.cc +++ b/contrib/libs/grpc/test/cpp/util/metrics_server.cc @@ -51,7 +51,7 @@ long QpsGauge::Get() { } grpc::Status MetricsServiceImpl::GetAllGauges( - ServerContext* /*context*/, const EmptyMessage* /*request*/, + ServerContext* /*context*/, const EmptyMessage* /*request*/, ServerWriter<GaugeResponse>* writer) { gpr_log(GPR_DEBUG, "GetAllGauges called"); @@ -66,7 +66,7 @@ grpc::Status MetricsServiceImpl::GetAllGauges( return Status::OK; } -grpc::Status MetricsServiceImpl::GetGauge(ServerContext* /*context*/, +grpc::Status MetricsServiceImpl::GetGauge(ServerContext* /*context*/, const GaugeRequest* request, GaugeResponse* response) { std::lock_guard<std::mutex> lock(mu_); diff --git a/contrib/libs/grpc/test/cpp/util/metrics_server.h b/contrib/libs/grpc/test/cpp/util/metrics_server.h index 10ffa7b4dd..2c3c358d1c 100644 --- a/contrib/libs/grpc/test/cpp/util/metrics_server.h +++ b/contrib/libs/grpc/test/cpp/util/metrics_server.h @@ -21,8 +21,8 @@ #include <map> #include <mutex> -#include <grpcpp/server.h> - +#include <grpcpp/server.h> + #include "src/proto/grpc/testing/metrics.grpc.pb.h" #include "src/proto/grpc/testing/metrics.pb.h" diff --git a/contrib/libs/grpc/test/cpp/util/proto_file_parser.h b/contrib/libs/grpc/test/cpp/util/proto_file_parser.h index c0445641c7..8ae383001c 100644 --- a/contrib/libs/grpc/test/cpp/util/proto_file_parser.h +++ b/contrib/libs/grpc/test/cpp/util/proto_file_parser.h @@ -62,7 +62,7 @@ class ProtoFileParser { /// \param is_json_format if \c true the \c formatted_proto is treated as a /// json-formatted proto, otherwise it is treated as a text-formatted /// proto - /// \return the serialised binary proto representation of \c formatted_proto + /// \return the serialised binary proto representation of \c formatted_proto TString GetSerializedProtoFromMethod(const TString& method, const TString& formatted_proto, bool is_request, @@ -71,7 +71,7 @@ class ProtoFileParser { /// Converts a text or json string to its proto representation for the given /// message type. /// \param formatted_proto the text- or json-formatted proto string - /// \return the serialised binary proto representation of \c formatted_proto + /// \return the serialised binary proto representation of \c formatted_proto TString GetSerializedProtoFromMessageType( const TString& message_type_name, const TString& formatted_proto, bool is_json_format); diff --git a/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.cc b/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.cc index 27a4c1e4cf..488f382999 100644 --- a/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.cc @@ -44,16 +44,16 @@ ProtoReflectionDescriptorDatabase::~ProtoReflectionDescriptorDatabase() { Status status = stream_->Finish(); if (!status.ok()) { if (status.error_code() == StatusCode::UNIMPLEMENTED) { - fprintf(stderr, + fprintf(stderr, "Reflection request not implemented; " - "is the ServerReflection service enabled?\n"); - } else { - fprintf(stderr, - "ServerReflectionInfo rpc failed. Error code: %d, message: %s, " - "debug info: %s\n", - static_cast<int>(status.error_code()), - status.error_message().c_str(), - ctx_.debug_error_string().c_str()); + "is the ServerReflection service enabled?\n"); + } else { + fprintf(stderr, + "ServerReflectionInfo rpc failed. Error code: %d, message: %s, " + "debug info: %s\n", + static_cast<int>(status.error_code()), + status.error_message().c_str(), + ctx_.debug_error_string().c_str()); } } } diff --git a/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.h b/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.h index cdd6f0cccd..6f6244278e 100644 --- a/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.h +++ b/contrib/libs/grpc/test/cpp/util/proto_reflection_descriptor_database.h @@ -44,7 +44,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase { // The following four methods implement DescriptorDatabase interfaces. // - // Find a file by file name. Fills in *output and returns true if found. + // Find a file by file name. Fills in *output and returns true if found. // Otherwise, returns false, leaving the contents of *output undefined. bool FindFileByName(const google::protobuf::string& filename, protobuf::FileDescriptorProto* output) override; diff --git a/contrib/libs/grpc/test/cpp/util/slice_test.cc b/contrib/libs/grpc/test/cpp/util/slice_test.cc index d7e945ae38..eeab4b298c 100644 --- a/contrib/libs/grpc/test/cpp/util/slice_test.cc +++ b/contrib/libs/grpc/test/cpp/util/slice_test.cc @@ -35,10 +35,10 @@ const char* kContent = "hello xxxxxxxxxxxxxxxxxxxx world"; class SliceTest : public ::testing::Test { protected: - static void SetUpTestCase() { grpc_init(); } - - static void TearDownTestCase() { grpc_shutdown(); } - + static void SetUpTestCase() { grpc_init(); } + + static void TearDownTestCase() { grpc_shutdown(); } + void CheckSliceSize(const Slice& s, const TString& content) { EXPECT_EQ(content.size(), s.size()); } @@ -82,7 +82,7 @@ TEST_F(SliceTest, SliceNew) { } TEST_F(SliceTest, SliceNewDoNothing) { - Slice spp(const_cast<char*>(kContent), strlen(kContent), [](void* /*p*/) {}); + Slice spp(const_cast<char*>(kContent), strlen(kContent), [](void* /*p*/) {}); CheckSlice(spp, kContent); } @@ -106,7 +106,7 @@ TEST_F(SliceTest, SliceNewWithUserData) { TEST_F(SliceTest, SliceNewLen) { Slice spp(const_cast<char*>(kContent), strlen(kContent), - [](void* /*p*/, size_t l) { EXPECT_EQ(l, strlen(kContent)); }); + [](void* /*p*/, size_t l) { EXPECT_EQ(l, strlen(kContent)); }); CheckSlice(spp, kContent); } diff --git a/contrib/libs/grpc/test/cpp/util/test_credentials_provider.cc b/contrib/libs/grpc/test/cpp/util/test_credentials_provider.cc index f7134b773f..98a89b51ee 100644 --- a/contrib/libs/grpc/test/cpp/util/test_credentials_provider.cc +++ b/contrib/libs/grpc/test/cpp/util/test_credentials_provider.cc @@ -19,50 +19,50 @@ #include "test/cpp/util/test_credentials_provider.h" -#include <cstdio> -#include <fstream> -#include <iostream> - +#include <cstdio> +#include <fstream> +#include <iostream> + #include <mutex> #include <unordered_map> -#include <gflags/gflags.h> +#include <gflags/gflags.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> -#include <grpcpp/security/server_credentials.h> +#include <grpcpp/security/server_credentials.h> #include "test/core/end2end/data/ssl_test_data.h" -DEFINE_string(tls_cert_file, "", "The TLS cert file used when --use_tls=true"); -DEFINE_string(tls_key_file, "", "The TLS key file used when --use_tls=true"); - +DEFINE_string(tls_cert_file, "", "The TLS cert file used when --use_tls=true"); +DEFINE_string(tls_key_file, "", "The TLS key file used when --use_tls=true"); + namespace grpc { namespace testing { namespace { TString ReadFile(const TString& src_path) { - std::ifstream src; - src.open(src_path, std::ifstream::in | std::ifstream::binary); - + std::ifstream src; + src.open(src_path, std::ifstream::in | std::ifstream::binary); + TString contents; - src.seekg(0, std::ios::end); - contents.reserve(src.tellg()); - src.seekg(0, std::ios::beg); - contents.assign((std::istreambuf_iterator<char>(src)), - (std::istreambuf_iterator<char>())); - return contents; -} - + src.seekg(0, std::ios::end); + contents.reserve(src.tellg()); + src.seekg(0, std::ios::beg); + contents.assign((std::istreambuf_iterator<char>(src)), + (std::istreambuf_iterator<char>())); + return contents; +} + class DefaultCredentialsProvider : public CredentialsProvider { public: - DefaultCredentialsProvider() { - if (!FLAGS_tls_key_file.empty()) { - custom_server_key_ = ReadFile(FLAGS_tls_key_file); - } - if (!FLAGS_tls_cert_file.empty()) { - custom_server_cert_ = ReadFile(FLAGS_tls_cert_file); - } - } + DefaultCredentialsProvider() { + if (!FLAGS_tls_key_file.empty()) { + custom_server_key_ = ReadFile(FLAGS_tls_key_file); + } + if (!FLAGS_tls_cert_file.empty()) { + custom_server_cert_ = ReadFile(FLAGS_tls_cert_file); + } + } ~DefaultCredentialsProvider() override {} void AddSecureType( @@ -92,7 +92,7 @@ class DefaultCredentialsProvider : public CredentialsProvider { } else if (type == grpc::testing::kTlsCredentialsType) { SslCredentialsOptions ssl_opts = {test_root_cert, "", ""}; args->SetSslTargetNameOverride("foo.test.google.fr"); - return grpc::SslCredentials(ssl_opts); + return grpc::SslCredentials(ssl_opts); } else if (type == grpc::testing::kGoogleDefaultCredentialsType) { return grpc::GoogleDefaultCredentials(); } else { @@ -118,15 +118,15 @@ class DefaultCredentialsProvider : public CredentialsProvider { } else if (type == grpc::testing::kTlsCredentialsType) { SslServerCredentialsOptions ssl_opts; ssl_opts.pem_root_certs = ""; - if (!custom_server_key_.empty() && !custom_server_cert_.empty()) { - SslServerCredentialsOptions::PemKeyCertPair pkcp = { - custom_server_key_, custom_server_cert_}; - ssl_opts.pem_key_cert_pairs.push_back(pkcp); - } else { - SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, - test_server1_cert}; - ssl_opts.pem_key_cert_pairs.push_back(pkcp); - } + if (!custom_server_key_.empty() && !custom_server_cert_.empty()) { + SslServerCredentialsOptions::PemKeyCertPair pkcp = { + custom_server_key_, custom_server_cert_}; + ssl_opts.pem_key_cert_pairs.push_back(pkcp); + } else { + SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, + test_server1_cert}; + ssl_opts.pem_key_cert_pairs.push_back(pkcp); + } return SslServerCredentials(ssl_opts); } else { std::unique_lock<std::mutex> lock(mu_); diff --git a/contrib/libs/grpc/test/cpp/util/ya.make b/contrib/libs/grpc/test/cpp/util/ya.make index f043cc5b14..72346d2811 100644 --- a/contrib/libs/grpc/test/cpp/util/ya.make +++ b/contrib/libs/grpc/test/cpp/util/ya.make @@ -9,7 +9,7 @@ OWNER(orivej) PEERDIR( contrib/libs/gflags contrib/libs/protoc - contrib/libs/grpc/src/proto/grpc/reflection/v1alpha + contrib/libs/grpc/src/proto/grpc/reflection/v1alpha contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest ) @@ -22,14 +22,14 @@ ADDINCL( NO_COMPILER_WARNINGS() SRCS( - byte_buffer_proto_helper.cc + byte_buffer_proto_helper.cc # grpc_cli_libs: cli_call.cc cli_credentials.cc grpc_tool.cc proto_file_parser.cc service_describer.cc - string_ref_helper.cc + string_ref_helper.cc # grpc++_proto_reflection_desc_db: proto_reflection_descriptor_database.cc # grpc++_test_config: |