diff options
author | ncteisen <ncteisen@gmail.com> | 2018-03-15 13:46:28 -1000 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2018-03-15 13:46:28 -1000 |
commit | b93a006d64f071ad0804b00f9b1064411a430092 (patch) | |
tree | d5971592bf7675ab5279723d46ab96f8e5827b5f /test/cpp | |
parent | 0c6024b94dc2a8aa9d851d8bc5d3a96e97802a55 (diff) | |
parent | 941dbaf9f0adb99f3fac4317c703084409a7a33d (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into channel-tracing
Diffstat (limited to 'test/cpp')
114 files changed, 639 insertions, 456 deletions
diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc index ee6958dfcf..826907ae4e 100644 --- a/test/cpp/client/client_channel_stress_test.cc +++ b/test/cpp/client/client_channel_stress_test.cc @@ -23,16 +23,16 @@ #include <sstream> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index 52efce18b3..e64e260a46 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -16,7 +16,7 @@ * */ -#include <grpc++/security/credentials.h> +#include <grpcpp/security/credentials.h> #include <memory> diff --git a/test/cpp/cocoapods/generic/generic.mm b/test/cpp/cocoapods/generic/generic.mm index 26f09b0af0..6e65176dd9 100644 --- a/test/cpp/cocoapods/generic/generic.mm +++ b/test/cpp/cocoapods/generic/generic.mm @@ -20,15 +20,15 @@ #include <sstream> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/generic/async_generic_service.h> -#include <grpc++/generic/generic_stub.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> -#include <grpc++/support/slice.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/generic/async_generic_service.h> +#include <grpcpp/generic/generic_stub.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> +#include <grpcpp/support/slice.h> #include <grpc/grpc.h> #include <grpc/support/time.h> diff --git a/test/cpp/cocoapods/test/server_context_test_spouse_test.mm b/test/cpp/cocoapods/test/server_context_test_spouse_test.mm index fd6878efbf..7cb1b36bf4 100644 --- a/test/cpp/cocoapods/test/server_context_test_spouse_test.mm +++ b/test/cpp/cocoapods/test/server_context_test_spouse_test.mm @@ -24,12 +24,12 @@ #import <XCTest/XCTest.h> -#include <grpc++/test/server_context_test_spouse.h> +#include <grpcpp/test/server_context_test_spouse.h> #include <cstring> #include <vector> -#include <grpc++/impl/grpc_library.h> +#include <grpcpp/impl/grpc_library.h> static grpc::internal::GrpcLibraryInitializer g_initializer; diff --git a/test/cpp/codegen/BUILD b/test/cpp/codegen/BUILD index 1388dbc650..12712a3e6c 100644 --- a/test/cpp/codegen/BUILD +++ b/test/cpp/codegen/BUILD @@ -61,7 +61,6 @@ grpc_cc_binary( srcs = ["golden_file_test.cc"], deps = [ "//:grpc++", - "//src/proto/grpc/testing:compiler_test_proto", "//test/core/util:gpr_test_util", ], external_deps = [ @@ -70,6 +69,20 @@ grpc_cc_binary( ], ) +genrule( + name = "copy_compiler_test_grpc_pb_h", + srcs = ["//src/proto/grpc/testing:_compiler_test_proto_grpc_codegen"], + cmd = "cat $(GENDIR)/src/proto/grpc/testing/compiler_test.grpc.pb.h > $@", + outs = ["compiler_test.grpc.pb.h"], +) + +genrule( + name = "copy_compiler_test_mock_grpc_pb_h", + srcs = ["//src/proto/grpc/testing:_compiler_test_proto_grpc_codegen"], + cmd = "cat $(GENDIR)/src/proto/grpc/testing/compiler_test_mock.grpc.pb.h > $@", + outs = ["compiler_test_mock.grpc.pb.h"], +) + grpc_sh_test( name = "run_golden_file_test", srcs = ["run_golden_file_test.sh"], @@ -77,6 +90,7 @@ grpc_sh_test( ":golden_file_test", ":compiler_test_golden", ":compiler_test_mock_golden", - "//src/proto/grpc/testing:_compiler_test_proto_grpc_codegen", + ":compiler_test.grpc.pb.h", + ":compiler_test_mock.grpc.pb.h", ], ) diff --git a/test/cpp/codegen/codegen_test_full.cc b/test/cpp/codegen/codegen_test_full.cc index 98792bde04..ccd310fc22 100644 --- a/test/cpp/codegen/codegen_test_full.cc +++ b/test/cpp/codegen/codegen_test_full.cc @@ -16,8 +16,8 @@ * */ -#include <grpc++/completion_queue.h> #include <grpc/support/time.h> +#include <grpcpp/completion_queue.h> #include <gtest/gtest.h> namespace grpc { diff --git a/test/cpp/codegen/proto_utils_test.cc b/test/cpp/codegen/proto_utils_test.cc index b64f9a0d17..836d3d8076 100644 --- a/test/cpp/codegen/proto_utils_test.cc +++ b/test/cpp/codegen/proto_utils_test.cc @@ -16,11 +16,11 @@ * */ -#include <grpc++/impl/codegen/grpc_library.h> -#include <grpc++/impl/codegen/proto_utils.h> -#include <grpc++/impl/grpc_library.h> #include <grpc/impl/codegen/byte_buffer.h> #include <grpc/slice.h> +#include <grpcpp/impl/codegen/grpc_library.h> +#include <grpcpp/impl/codegen/proto_utils.h> +#include <grpcpp/impl/grpc_library.h> #include <gtest/gtest.h> namespace grpc { diff --git a/test/cpp/codegen/run_golden_file_test.sh b/test/cpp/codegen/run_golden_file_test.sh index cdfaa96a1c..8fe801c876 100755 --- a/test/cpp/codegen/run_golden_file_test.sh +++ b/test/cpp/codegen/run_golden_file_test.sh @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -ex +set -eux -GENERATED_FILES_PATH="$TEST_SRCDIR/../../../../../genfiles/src/proto/grpc/testing/" -test/cpp/codegen/golden_file_test --generated_file_path="$GENERATED_FILES_PATH" +GENERATED_PB_H_DIR="${TEST_SRCDIR}/com_github_grpc_grpc/test/cpp/codegen/" +test/cpp/codegen/golden_file_test --generated_file_path="$GENERATED_PB_H_DIR" diff --git a/test/cpp/common/alarm_test.cc b/test/cpp/common/alarm_test.cc index 376aa3e32e..fb5f6713d1 100644 --- a/test/cpp/common/alarm_test.cc +++ b/test/cpp/common/alarm_test.cc @@ -16,8 +16,8 @@ * */ -#include <grpc++/alarm.h> -#include <grpc++/completion_queue.h> +#include <grpcpp/alarm.h> +#include <grpcpp/completion_queue.h> #include <thread> #include <gtest/gtest.h> diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index fce409aa2f..9634555e4b 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -16,8 +16,8 @@ * */ -#include <grpc++/security/auth_context.h> #include <grpc/grpc_security.h> +#include <grpcpp/security/auth_context.h> #include <gtest/gtest.h> #include "src/cpp/common/secure_auth_context.h" #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/common/channel_arguments_test.cc b/test/cpp/common/channel_arguments_test.cc index 29e225d924..183d2afa78 100644 --- a/test/cpp/common/channel_arguments_test.cc +++ b/test/cpp/common/channel_arguments_test.cc @@ -16,10 +16,10 @@ * */ -#include <grpc++/support/channel_arguments.h> +#include <grpcpp/support/channel_arguments.h> -#include <grpc++/grpc++.h> #include <grpc/grpc.h> +#include <grpcpp/grpcpp.h> #include <gtest/gtest.h> #include "src/core/lib/gpr/useful.h" diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index 7a0530c20a..6461f49743 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -17,8 +17,8 @@ */ #include "src/cpp/common/secure_auth_context.h" -#include <grpc++/security/auth_context.h> #include <grpc/grpc_security.h> +#include <grpcpp/security/auth_context.h> #include <gtest/gtest.h> #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index d3620584a9..dd777d10c2 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -20,17 +20,17 @@ #include <memory> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/ext/health_check_service_server_builder_option.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/ext/health_check_service_server_builder_option.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/core/lib/gpr/env.h" #include "src/core/lib/gpr/tls.h" diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 6bde6641b7..2a06f44c60 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -16,15 +16,15 @@ * */ -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc index 887504d308..cb4afd7167 100644 --- a/test/cpp/end2end/client_crash_test_server.cc +++ b/test/cpp/end2end/client_crash_test_server.cc @@ -21,10 +21,10 @@ #include <memory> #include <string> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/support/log.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 96a855c30e..a39e443cf0 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -22,17 +22,17 @@ #include <random> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/atm.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/ext/filters/client_channel/subchannel_index.h" @@ -40,6 +40,7 @@ #include "src/core/lib/gpr/env.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" +#include "src/core/lib/iomgr/tcp_client.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" @@ -52,13 +53,10 @@ using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; -// defined in tcp_client_posix.c -extern void (*grpc_tcp_client_connect_impl)( - grpc_closure* closure, grpc_endpoint** ep, - grpc_pollset_set* interested_parties, const grpc_channel_args* channel_args, - const grpc_resolved_address* addr, grpc_millis deadline); +// defined in tcp_client.cc +extern grpc_tcp_client_vtable* grpc_tcp_client_impl; -const auto original_tcp_connect_fn = grpc_tcp_client_connect_impl; +static grpc_tcp_client_vtable* default_client_impl; namespace grpc { namespace testing { @@ -75,10 +73,12 @@ void tcp_client_connect_with_delay(grpc_closure* closure, grpc_endpoint** ep, if (delay_ms > 0) { gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(delay_ms)); } - original_tcp_connect_fn(closure, ep, interested_parties, channel_args, addr, - deadline + delay_ms); + default_client_impl->connect(closure, ep, interested_parties, channel_args, + addr, deadline + delay_ms); } +grpc_tcp_client_vtable delayed_connect = {tcp_client_connect_with_delay}; + // Subclass of TestServiceImpl that increments a request counter for // every call to the Echo RPC. class MyTestServiceImpl : public TestServiceImpl { @@ -384,7 +384,8 @@ TEST_F(ClientLbEnd2endTest, PickFirstBackOffMinReconnect) { // Make connection delay a 10% longer than it's willing to in order to make // sure we are hitting the codepath that waits for the min reconnect backoff. gpr_atm_rel_store(&g_connection_delay_ms, kMinReconnectBackOffMs * 1.10); - grpc_tcp_client_connect_impl = tcp_client_connect_with_delay; + default_client_impl = grpc_tcp_client_impl; + grpc_set_tcp_client_impl(&delayed_connect); const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC); channel->WaitForConnected( grpc_timeout_milliseconds_to_deadline(kMinReconnectBackOffMs * 2)); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 1e2cdb8b62..60238e930d 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -19,20 +19,20 @@ #include <mutex> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/resource_quota.h> -#include <grpc++/security/auth_metadata_processor.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/resource_quota.h> +#include <grpcpp/security/auth_metadata_processor.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/core/lib/gpr/env.h" #include "src/core/lib/security/credentials/credentials.h" diff --git a/test/cpp/end2end/exception_test.cc b/test/cpp/end2end/exception_test.cc index 76272ad08a..5343997663 100644 --- a/test/cpp/end2end/exception_test.cc +++ b/test/cpp/end2end/exception_test.cc @@ -19,12 +19,12 @@ #include <exception> #include <memory> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/impl/codegen/port_platform.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/test_config.h" @@ -87,24 +87,28 @@ TEST_F(ExceptionTest, Unary) { EchoRequest request; EchoResponse response; request.set_message("test"); - ClientContext context; - Status s = stub_->Echo(&context, request, &response); - EXPECT_FALSE(s.ok()); - EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN); + for (int i = 0; i < 10; i++) { + ClientContext context; + Status s = stub_->Echo(&context, request, &response); + EXPECT_FALSE(s.ok()); + EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN); + } } TEST_F(ExceptionTest, RequestStream) { ResetStub(); EchoResponse response; - ClientContext context; - auto stream = stub_->RequestStream(&context, &response); - stream->WritesDone(); - Status s = stream->Finish(); + for (int i = 0; i < 10; i++) { + ClientContext context; + auto stream = stub_->RequestStream(&context, &response); + stream->WritesDone(); + Status s = stream->Finish(); - EXPECT_FALSE(s.ok()); - EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN); + EXPECT_FALSE(s.ok()); + EXPECT_EQ(s.error_code(), StatusCode::UNKNOWN); + } } #endif // GRPC_ALLOW_EXCEPTIONS diff --git a/test/cpp/end2end/filter_end2end_test.cc b/test/cpp/end2end/filter_end2end_test.cc index 20804bc19e..88f8f380c3 100644 --- a/test/cpp/end2end/filter_end2end_test.cc +++ b/test/cpp/end2end/filter_end2end_test.cc @@ -19,19 +19,19 @@ #include <memory> #include <mutex> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/generic/async_generic_service.h> -#include <grpc++/generic/generic_stub.h> -#include <grpc++/impl/codegen/proto_utils.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> -#include <grpc++/support/config.h> -#include <grpc++/support/slice.h> #include <grpc/grpc.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/generic/async_generic_service.h> +#include <grpcpp/generic/generic_stub.h> +#include <grpcpp/impl/codegen/proto_utils.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> +#include <grpcpp/support/config.h> +#include <grpcpp/support/slice.h> #include "src/cpp/common/channel_filter.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 42b15a06e9..88a1227ca2 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -18,18 +18,18 @@ #include <memory> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/generic/async_generic_service.h> -#include <grpc++/generic/generic_stub.h> -#include <grpc++/impl/codegen/proto_utils.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> -#include <grpc++/support/slice.h> #include <grpc/grpc.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/generic/async_generic_service.h> +#include <grpcpp/generic/generic_stub.h> +#include <grpcpp/impl/codegen/proto_utils.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> +#include <grpcpp/support/slice.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 33f485be93..557845618e 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -21,16 +21,16 @@ #include <sstream> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/gpr/env.h" @@ -61,8 +61,6 @@ // - Test handling of creation of faulty RR instance by having the LB return a // serverlist with non-existent backends after having initially returned a // valid one. -// - test using secure credentials and make sure we don't send call -// credentials to the balancer // // Findings from end to end testing to be covered here: // - Handling of LB servers restart, including reconnection after backing-off @@ -126,12 +124,22 @@ class CountedService : public ServiceType { using BackendService = CountedService<TestServiceImpl>; using BalancerService = CountedService<LoadBalancer::Service>; +const char g_kCallCredsMdKey[] = "Balancer should not ..."; +const char g_kCallCredsMdValue[] = "... receive me"; + class BackendServiceImpl : public BackendService { public: BackendServiceImpl() {} Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) override { + // Backend should receive the call credentials metadata. + auto call_credentials_entry = + context->client_metadata().find(g_kCallCredsMdKey); + EXPECT_NE(call_credentials_entry, context->client_metadata().end()); + if (call_credentials_entry != context->client_metadata().end()) { + EXPECT_EQ(call_credentials_entry->second, g_kCallCredsMdValue); + } IncreaseRequestCount(); const auto status = TestServiceImpl::Echo(context, request, response); IncreaseResponseCount(); @@ -190,6 +198,9 @@ class BalancerServiceImpl : public BalancerService { shutdown_(false) {} Status BalanceLoad(ServerContext* context, Stream* stream) override { + // Balancer shouldn't receive the call credentials metadata. + EXPECT_EQ(context->client_metadata().find(g_kCallCredsMdKey), + context->client_metadata().end()); gpr_log(GPR_INFO, "LB[%p]: BalanceLoad", this); LoadBalanceRequest request; std::vector<ResponseDelayPair> responses_and_delays; @@ -394,8 +405,15 @@ class GrpclbEnd2endTest : public ::testing::Test { uri << "fake:///" << kApplicationTargetName_; // TODO(dgq): templatize tests to run everything using both secure and // insecure channel credentials. - std::shared_ptr<ChannelCredentials> creds(new SecureChannelCredentials( - grpc_fake_transport_security_credentials_create())); + grpc_channel_credentials* channel_creds = + grpc_fake_transport_security_credentials_create(); + grpc_call_credentials* call_creds = grpc_md_only_test_credentials_create( + g_kCallCredsMdKey, g_kCallCredsMdValue, false); + std::shared_ptr<ChannelCredentials> creds( + new SecureChannelCredentials(grpc_composite_channel_credentials_create( + channel_creds, call_creds, nullptr))); + grpc_call_credentials_unref(call_creds); + grpc_channel_credentials_unref(channel_creds); channel_ = CreateCustomChannel(uri.str(), creds, args); stub_ = grpc::testing::EchoTestService::NewStub(channel_); } diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index de732e0154..1c48b9d151 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -21,16 +21,16 @@ #include <thread> #include <vector> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/ext/health_check_service_server_builder_option.h> -#include <grpc++/health_check_service_interface.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/ext/health_check_service_server_builder_option.h> +#include <grpcpp/health_check_service_interface.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/health/v1/health.grpc.pb.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index 38d6bfa83b..10e16429e6 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -19,14 +19,14 @@ #include <memory> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/generic/async_generic_service.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/generic/async_generic_service.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index e3976a4838..ff49902fea 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -19,15 +19,15 @@ #include <climits> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" @@ -35,7 +35,7 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include <grpc++/test/mock_stream.h> +#include <grpcpp/test/mock_stream.h> #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/test/cpp/end2end/nonblocking_test.cc b/test/cpp/end2end/nonblocking_test.cc index 509c5de0b6..cb75848337 100644 --- a/test/cpp/end2end/nonblocking_test.cc +++ b/test/cpp/end2end/nonblocking_test.cc @@ -18,12 +18,12 @@ #include <memory> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/core/lib/gpr/tls.h" #include "src/core/lib/iomgr/port.h" diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc index b645d90c63..21a275ef62 100644 --- a/test/cpp/end2end/proto_server_reflection_test.cc +++ b/test/cpp/end2end/proto_server_reflection_test.cc @@ -16,16 +16,16 @@ * */ -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/ext/proto_server_reflection_plugin.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/ext/proto_server_reflection_plugin.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc index eee32ce85d..846347e110 100644 --- a/test/cpp/end2end/round_robin_end2end_test.cc +++ b/test/cpp/end2end/round_robin_end2end_test.cc @@ -20,14 +20,14 @@ #include <mutex> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc index 2951a2ebcf..d54523fcbb 100644 --- a/test/cpp/end2end/server_builder_plugin_test.cc +++ b/test/cpp/end2end/server_builder_plugin_test.cc @@ -18,18 +18,18 @@ #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/impl/server_builder_option.h> -#include <grpc++/impl/server_builder_plugin.h> -#include <grpc++/impl/server_initializer.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/impl/server_builder_option.h> +#include <grpcpp/impl/server_builder_plugin.h> +#include <grpcpp/impl/server_initializer.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 108dcd29e7..93257b2705 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -16,15 +16,15 @@ * */ -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 45995769fa..c05fcfdb81 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -22,10 +22,10 @@ #include <sstream> #include <string> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/server_early_return_test.cc b/test/cpp/end2end/server_early_return_test.cc index a0349fdc4c..8948e5b854 100644 --- a/test/cpp/end2end/server_early_return_test.cc +++ b/test/cpp/end2end/server_early_return_test.cc @@ -16,18 +16,18 @@ * */ -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index 9119102f7a..a53de691bc 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -18,15 +18,15 @@ #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/core/lib/gpr/env.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index 4dc1d1f1d9..898d1ec118 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -20,18 +20,18 @@ #include <mutex> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/atm.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index 875a27b5f5..3c3a5d9cd4 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -21,9 +21,9 @@ #include <string> #include <thread> -#include <grpc++/security/credentials.h> -#include <grpc++/server_context.h> #include <grpc/support/log.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/end2end/test_service_impl.h b/test/cpp/end2end/test_service_impl.h index 070f357139..052543a03e 100644 --- a/test/cpp/end2end/test_service_impl.h +++ b/test/cpp/end2end/test_service_impl.h @@ -21,8 +21,8 @@ #include <memory> #include <mutex> -#include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 828beefea3..e709a25356 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -19,14 +19,14 @@ #include <mutex> #include <thread> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/core/lib/surface/api_trace.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index 1f2ef0c2de..ecba9f9ca3 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -16,8 +16,8 @@ * */ -#include <grpc++/impl/codegen/config.h> #include <grpc/grpc.h> +#include <grpcpp/impl/codegen/config.h> #include <gtest/gtest.h> #include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h" diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 4da9639d25..ca8ee3de06 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -20,11 +20,11 @@ #include <unordered_map> #include <gflags/gflags.h> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> #include "src/core/lib/gpr/string.h" #include "test/cpp/interop/client_helper.h" diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index fee34c52c3..4041f95abc 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -23,12 +23,12 @@ #include <sstream> #include <gflags/gflags.h> -#include <grpc++/channel.h> -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> #include "src/cpp/client/secure_credentials.h" #include "test/core/security/oauth2_utils.h" diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h index f6e5bc9a51..eada2f671f 100644 --- a/test/cpp/interop/client_helper.h +++ b/test/cpp/interop/client_helper.h @@ -22,7 +22,7 @@ #include <memory> #include <unordered_map> -#include <grpc++/channel.h> +#include <grpcpp/channel.h> #include "src/core/lib/surface/call_test_only.h" diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc index 411812d583..821815c6e8 100644 --- a/test/cpp/interop/http2_client.cc +++ b/test/cpp/interop/http2_client.cc @@ -19,10 +19,10 @@ #include <thread> #include <gflags/gflags.h> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> #include "src/core/lib/transport/byte_stream.h" #include "src/proto/grpc/testing/messages.pb.h" diff --git a/test/cpp/interop/http2_client.h b/test/cpp/interop/http2_client.h index f64041a803..2bcfdd69db 100644 --- a/test/cpp/interop/http2_client.h +++ b/test/cpp/interop/http2_client.h @@ -21,8 +21,8 @@ #include <memory> -#include <grpc++/channel.h> #include <grpc/grpc.h> +#include <grpcpp/channel.h> #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 865b5c407f..68bf1e6dc7 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -20,14 +20,14 @@ #include <fstream> #include <memory> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/security/credentials.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/security/credentials.h> #include "src/core/lib/transport/byte_stream.h" #include "src/proto/grpc/testing/empty.pb.h" diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index b8bb134c20..79ff24fc47 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -21,8 +21,8 @@ #include <memory> -#include <grpc++/channel.h> #include <grpc/grpc.h> +#include <grpcpp/channel.h> #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index f78a1f1d8a..5fa1a336da 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -22,13 +22,13 @@ #include <thread> #include <gflags/gflags.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/core/lib/gpr/string.h" #include "src/core/lib/transport/byte_stream.h" diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index 1c6237879d..02cd564335 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -20,8 +20,8 @@ #include <string> #include <gflags/gflags.h> -#include <grpc++/grpc++.h> #include <grpc/support/log.h> +#include <grpcpp/grpcpp.h> #include "src/proto/grpc/testing/metrics.grpc.pb.h" #include "src/proto/grpc/testing/metrics.pb.h" diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index 2d9397a2b8..9a451fa3f2 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -20,11 +20,11 @@ #include <sstream> #include <gflags/gflags.h> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/support/channel_arguments.h> #include <grpc/grpc.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/support/channel_arguments.h> #include "src/proto/grpc/testing/empty.pb.h" #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc index 5e257e1b38..e690c8fb00 100644 --- a/test/cpp/interop/reconnect_interop_server.cc +++ b/test/cpp/interop/reconnect_interop_server.cc @@ -26,11 +26,11 @@ #include <sstream> #include <gflags/gflags.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/log.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "src/proto/grpc/testing/empty.pb.h" #include "src/proto/grpc/testing/messages.pb.h" diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc index be449a9262..93ffd52560 100644 --- a/test/cpp/interop/server_helper.cc +++ b/test/cpp/interop/server_helper.cc @@ -21,7 +21,7 @@ #include <memory> #include <gflags/gflags.h> -#include <grpc++/security/server_credentials.h> +#include <grpcpp/security/server_credentials.h> #include "src/core/lib/surface/call_test_only.h" #include "test/cpp/util/test_credentials_provider.h" diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h index 1bf7db1e14..3004e7ff81 100644 --- a/test/cpp/interop/server_helper.h +++ b/test/cpp/interop/server_helper.h @@ -25,8 +25,8 @@ #include <grpc/compression.h> #include <grpc/impl/codegen/atm.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server_context.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server_context.h> namespace grpc { namespace testing { diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc index 7afddbb26b..30a8351cfe 100644 --- a/test/cpp/interop/stress_interop_client.cc +++ b/test/cpp/interop/stress_interop_client.cc @@ -22,8 +22,8 @@ #include <string> #include <vector> -#include <grpc++/create_channel.h> #include <grpc/support/log.h> +#include <grpcpp/create_channel.h> #include "test/cpp/interop/interop_client.h" #include "test/cpp/util/metrics_server.h" diff --git a/test/cpp/interop/stress_interop_client.h b/test/cpp/interop/stress_interop_client.h index ee15be0f08..a306dc3565 100644 --- a/test/cpp/interop/stress_interop_client.h +++ b/test/cpp/interop/stress_interop_client.h @@ -23,7 +23,7 @@ #include <string> #include <vector> -#include <grpc++/create_channel.h> +#include <grpcpp/create_channel.h> #include "test/cpp/interop/interop_client.h" #include "test/cpp/util/metrics_server.h" diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 4b39dc3211..6e8134a83b 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -23,10 +23,10 @@ #include <vector> #include <gflags/gflags.h> -#include <grpc++/create_channel.h> -#include <grpc++/grpc++.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/grpcpp.h> #include "src/proto/grpc/testing/metrics.grpc.pb.h" #include "src/proto/grpc/testing/metrics.pb.h" diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index 0b69e9ba9a..67f7e440b0 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -143,3 +143,10 @@ grpc_cc_binary( srcs = ["bm_metadata.cc"], deps = [":helpers"], ) + +grpc_cc_binary( + name = "bm_chttp2_hpack", + testonly = 1, + srcs = ["bm_chttp2_hpack.cc"], + deps = [":helpers"], +) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 5c2c38c27d..85a9f5e137 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -23,11 +23,11 @@ #include <string.h> #include <sstream> -#include <grpc++/channel.h> -#include <grpc++/support/channel_arguments.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> +#include <grpcpp/channel.h> +#include <grpcpp/support/channel_arguments.h> #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/deadline/deadline_filter.h" diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 07bb3c92ae..d0f3ec8e8b 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -18,9 +18,11 @@ /* Microbenchmarks around CHTTP2 HPACK operations */ +#include <benchmark/benchmark.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <string.h> +#include <memory> #include <sstream> #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" @@ -31,7 +33,6 @@ #include "src/core/lib/transport/timeout_encoding.h" #include "test/cpp/microbenchmarks/helpers.h" -#include "third_party/benchmark/include/benchmark/benchmark.h" auto& force_library_initialization = Library::get(); @@ -51,10 +52,11 @@ static grpc_slice MakeSlice(std::vector<uint8_t> bytes) { static void BM_HpackEncoderInitDestroy(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; - grpc_chttp2_hpack_compressor c; + std::unique_ptr<grpc_chttp2_hpack_compressor> c( + new grpc_chttp2_hpack_compressor); while (state.KeepRunning()) { - grpc_chttp2_hpack_compressor_init(&c); - grpc_chttp2_hpack_compressor_destroy(&c); + grpc_chttp2_hpack_compressor_init(c.get()); + grpc_chttp2_hpack_compressor_destroy(c.get()); grpc_core::ExecCtx::Get()->Flush(); } @@ -71,8 +73,9 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) { grpc_metadata_batch_init(&b); b.deadline = saved_now + 30 * 1000; - grpc_chttp2_hpack_compressor c; - grpc_chttp2_hpack_compressor_init(&c); + std::unique_ptr<grpc_chttp2_hpack_compressor> c( + new grpc_chttp2_hpack_compressor); + grpc_chttp2_hpack_compressor_init(c.get()); grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); grpc_slice_buffer outbuf; @@ -85,12 +88,12 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) { static_cast<size_t>(1024), &stats, }; - grpc_chttp2_encode_header(&c, nullptr, 0, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(c.get(), nullptr, 0, &b, &hopt, &outbuf); grpc_slice_buffer_reset_and_unref_internal(&outbuf); grpc_core::ExecCtx::Get()->Flush(); } grpc_metadata_batch_destroy(&b); - grpc_chttp2_hpack_compressor_destroy(&c); + grpc_chttp2_hpack_compressor_destroy(c.get()); grpc_slice_buffer_destroy_internal(&outbuf); std::ostringstream label; @@ -120,8 +123,9 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { "addmd", grpc_metadata_batch_add_tail(&b, &storage[i], elems[i]))); } - grpc_chttp2_hpack_compressor c; - grpc_chttp2_hpack_compressor_init(&c); + std::unique_ptr<grpc_chttp2_hpack_compressor> c( + new grpc_chttp2_hpack_compressor); + grpc_chttp2_hpack_compressor_init(c.get()); grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); grpc_slice_buffer outbuf; @@ -134,7 +138,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { static_cast<size_t>(state.range(1)), &stats, }; - grpc_chttp2_encode_header(&c, nullptr, 0, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(c.get(), nullptr, 0, &b, &hopt, &outbuf); if (!logged_representative_output && state.iterations() > 3) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { @@ -147,7 +151,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { grpc_core::ExecCtx::Get()->Flush(); } grpc_metadata_batch_destroy(&b); - grpc_chttp2_hpack_compressor_destroy(&c); + grpc_chttp2_hpack_compressor_destroy(c.get()); grpc_slice_buffer_destroy_internal(&outbuf); std::ostringstream label; diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index fcb1677d09..d00c79b610 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -18,10 +18,10 @@ /* Microbenchmarks around CHTTP2 transport operations */ -#include <grpc++/support/channel_arguments.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include <grpcpp/support/channel_arguments.h> #include <string.h> #include <memory> #include <queue> @@ -398,13 +398,13 @@ static void BM_TransportStreamSend(benchmark::State& state) { memset(&op, 0, sizeof(op)); op.payload = &op_payload; }; - grpc_slice_buffer_stream send_stream; - grpc_slice_buffer send_buffer; - grpc_slice_buffer_init(&send_buffer); - grpc_slice_buffer_add(&send_buffer, gpr_slice_malloc(state.range(0))); - memset(GRPC_SLICE_START_PTR(send_buffer.slices[0]), 0, - GRPC_SLICE_LENGTH(send_buffer.slices[0])); - + // Create the send_message payload slice. + // Note: We use grpc_slice_malloc_large() instead of grpc_slice_malloc() + // to force the slice to be refcounted, so that it remains alive when it + // is unreffed after each send_message op. + grpc_slice send_slice = grpc_slice_malloc_large(state.range(0)); + memset(GRPC_SLICE_START_PTR(send_slice), 0, GRPC_SLICE_LENGTH(send_slice)); + grpc_core::ManualConstructor<grpc_core::SliceBufferByteStream> send_stream; grpc_metadata_batch b; grpc_metadata_batch_init(&b); b.deadline = GRPC_MILLIS_INF_FUTURE; @@ -424,14 +424,18 @@ static void BM_TransportStreamSend(benchmark::State& state) { gpr_event_set(bm_done, (void*)1); return; } + grpc_slice_buffer send_buffer; + grpc_slice_buffer_init(&send_buffer); + grpc_slice_buffer_add(&send_buffer, grpc_slice_ref(send_slice)); + send_stream.Init(&send_buffer, 0); + grpc_slice_buffer_destroy(&send_buffer); // force outgoing window to be yuge s->chttp2_stream()->flow_control->TestOnlyForceHugeWindow(); f.chttp2_transport()->flow_control->TestOnlyForceHugeWindow(); - grpc_slice_buffer_stream_init(&send_stream, &send_buffer, 0); reset_op(); op.on_complete = c.get(); op.send_message = true; - op.payload->send_message.send_message = &send_stream.base; + op.payload->send_message.send_message.reset(send_stream.get()); s->Op(&op); }); @@ -454,7 +458,7 @@ static void BM_TransportStreamSend(benchmark::State& state) { s.reset(); track_counters.Finish(state); grpc_metadata_batch_destroy(&b); - grpc_slice_buffer_destroy(&send_buffer); + grpc_slice_unref(send_slice); } BENCHMARK(BM_TransportStreamSend)->Range(0, 128 * 1024 * 1024); @@ -524,7 +528,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) { grpc_transport_stream_op_batch_payload op_payload; memset(&op_payload, 0, sizeof(op_payload)); grpc_transport_stream_op_batch op; - grpc_byte_stream* recv_stream; + grpc_core::OrphanablePtr<grpc_core::ByteStream> recv_stream; grpc_slice incoming_data = CreateIncomingDataSlice(state.range(0), 16384); auto reset_op = [&]() { @@ -579,21 +583,20 @@ static void BM_TransportStreamRecv(benchmark::State& state) { drain = MakeClosure([&](grpc_error* error) { do { - if (received == recv_stream->length) { - grpc_byte_stream_destroy(recv_stream); + if (received == recv_stream->length()) { + recv_stream.reset(); GRPC_CLOSURE_SCHED(c.get(), GRPC_ERROR_NONE); return; } - } while (grpc_byte_stream_next(recv_stream, recv_stream->length - received, - drain_continue.get()) && - GRPC_ERROR_NONE == - grpc_byte_stream_pull(recv_stream, &recv_slice) && + } while (recv_stream->Next(recv_stream->length() - received, + drain_continue.get()) && + GRPC_ERROR_NONE == recv_stream->Pull(&recv_slice) && (received += GRPC_SLICE_LENGTH(recv_slice), grpc_slice_unref_internal(recv_slice), true)); }); drain_continue = MakeClosure([&](grpc_error* error) { - grpc_byte_stream_pull(recv_stream, &recv_slice); + recv_stream->Pull(&recv_slice); received += GRPC_SLICE_LENGTH(recv_slice); grpc_slice_unref_internal(recv_slice); GRPC_CLOSURE_RUN(drain.get(), GRPC_ERROR_NONE); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 97242598f1..342a95ed10 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -20,10 +20,10 @@ * working */ #include <benchmark/benchmark.h> -#include <grpc++/completion_queue.h> -#include <grpc++/impl/grpc_library.h> #include <grpc/grpc.h> #include <grpc/support/log.h> +#include <grpcpp/completion_queue.h> +#include <grpcpp/impl/grpc_library.h> #include "test/cpp/microbenchmarks/helpers.h" #include "src/core/lib/surface/completion_queue.h" diff --git a/test/cpp/microbenchmarks/fullstack_context_mutators.h b/test/cpp/microbenchmarks/fullstack_context_mutators.h index 3584280c48..6e7fd57540 100644 --- a/test/cpp/microbenchmarks/fullstack_context_mutators.h +++ b/test/cpp/microbenchmarks/fullstack_context_mutators.h @@ -19,14 +19,14 @@ #ifndef TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H #define TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H -#include <grpc++/channel.h> -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include "test/cpp/microbenchmarks/helpers.h" diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index ab6c194830..9d70277fbc 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -19,14 +19,14 @@ #ifndef TEST_CPP_MICROBENCHMARKS_FULLSTACK_FIXTURES_H #define TEST_CPP_MICROBENCHMARKS_FULLSTACK_FIXTURES_H -#include <grpc++/channel.h> -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/support/atm.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index afa3e0f3ca..4aabd4094a 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -27,7 +27,7 @@ #include "test/core/util/memory_counters.h" #include <benchmark/benchmark.h> -#include <grpc++/impl/grpc_library.h> +#include <grpcpp/impl/grpc_library.h> class Library { public: diff --git a/test/cpp/naming/BUILD b/test/cpp/naming/BUILD index a8fa0a078a..54b53d2792 100644 --- a/test/cpp/naming/BUILD +++ b/test/cpp/naming/BUILD @@ -34,17 +34,4 @@ grpc_sh_binary( ], ) -grpc_py_binary( - name = "test_dns_server", - srcs = ["test_dns_server.py"], - testonly = True, - data = [ - "resolver_test_record_groups.yaml", - ], - external_deps = [ - "twisted", - "yaml", - ] -) - generate_resolver_component_tests() diff --git a/test/cpp/naming/generate_resolver_component_tests.bzl b/test/cpp/naming/generate_resolver_component_tests.bzl index 118d9452d9..d0fb51439f 100755 --- a/test/cpp/naming/generate_resolver_component_tests.bzl +++ b/test/cpp/naming/generate_resolver_component_tests.bzl @@ -54,7 +54,9 @@ def generate_resolver_component_tests(): data = [ ":resolver_component_tests_runner", ":resolver_component_test%s" % unsecure_build_config_suffix, - ":test_dns_server", + "//test/cpp/naming/utils:dns_server", + "//test/cpp/naming/utils:dns_resolver", + "//test/cpp/naming/utils:tcp_connect", "resolver_test_record_groups.yaml", # include the transitive dependency so that the dns sever py binary can locate this ], args = [ diff --git a/test/cpp/naming/resolver_component_tests_runner.sh b/test/cpp/naming/resolver_component_tests_runner.sh index 618a173dc0..18b56ab69b 100755 --- a/test/cpp/naming/resolver_component_tests_runner.sh +++ b/test/cpp/naming/resolver_component_tests_runner.sh @@ -18,12 +18,14 @@ set -ex # all command args required in this set order -FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | cut -d "=" -f 2) -FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | cut -d "=" -f 2) -FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | cut -d "=" -f 2) -FLAGS_test_dns_server_port=$(echo "$4" | grep '\--test_dns_server_port=' | cut -d "=" -f 2) - -for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_test_dns_server_port"; do +FLAGS_test_bin_path=$(echo "$1" | grep '\--test_bin_path=' | sed 's/^--test_bin_path=//') +FLAGS_dns_server_bin_path=$(echo "$2" | grep '\--dns_server_bin_path=' | sed 's/^--dns_server_bin_path=//') +FLAGS_records_config_path=$(echo "$3" | grep '\--records_config_path=' | sed 's/^--records_config_path=//') +FLAGS_dns_server_port=$(echo "$4" | grep '\--dns_server_port=' | sed 's/^--dns_server_port=//') +FLAGS_dns_resolver_bin_path=$(echo "$5" | grep '\--dns_resolver_bin_path=' | sed 's/^--dns_resolver_bin_path=//') +FLAGS_tcp_connect_bin_path=$(echo "$6" | grep '\--tcp_connect_bin_path=' | sed 's/^--tcp_connect_bin_path=//') + +for cmd_arg in "$FLAGS_test_bin_path" "$FLAGS_dns_server_bin_path" "$FLAGS_records_config_path" "$FLAGS_dns_server_port" "$FLAGS_dns_resolver_bin_path" "$FLAGS_tcp_connect_bin_path"; do if [[ "$cmd_arg" == "" ]]; then echo "Missing a CMD arg" && exit 1 fi @@ -34,17 +36,17 @@ if [[ "$GRPC_DNS_RESOLVER" != "" && "$GRPC_DNS_RESOLVER" != ares ]]; then fi export GRPC_DNS_RESOLVER=ares -"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_test_dns_server_port" > /dev/null 2>&1 & +"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_dns_server_port" > /dev/null 2>&1 & DNS_SERVER_PID=$! echo "Local DNS server started. PID: $DNS_SERVER_PID" # Health check local DNS server TCP and UDP ports for ((i=0;i<30;i++)); do - echo "Retry health-check DNS query to local DNS server over tcp and udp" + echo "Retry health-check local DNS server by attempting a DNS query and TCP handshake" RETRY=0 - dig A health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. @localhost -p "$FLAGS_test_dns_server_port" +tries=1 +timeout=1 | grep '123.123.123.123' || RETRY=1 - dig A health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. @localhost -p "$FLAGS_test_dns_server_port" +tries=1 +timeout=1 +tcp | grep '123.123.123.123' || RETRY=1 + $FLAGS_dns_resolver_bin_path -s 127.0.0.1 -p "$FLAGS_dns_server_port" -n health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp. -t 1 | grep '123.123.123.123' || RETRY=1 + $FLAGS_tcp_connect_bin_path -s 127.0.0.1 -p "$FLAGS_dns_server_port" -t 1 || RETRY=1 if [[ "$RETRY" == 0 ]]; then break fi; @@ -77,7 +79,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:1234,True' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -85,7 +87,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.5:1234,True;1.2.3.6:1234,True;1.2.3.7:1234,True' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -93,7 +95,7 @@ $FLAGS_test_bin_path \ --expected_addrs='[2607:f8b0:400a:801::1001]:1234,True' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -101,7 +103,7 @@ $FLAGS_test_bin_path \ --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1003]:1234,True;[2607:f8b0:400a:801::1004]:1234,True' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -109,7 +111,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:1234,True' \ --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}' \ --expected_lb_policy='round_robin' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -117,7 +119,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:443,False' \ --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"NoSrvSimpleService","waitForReady":true}]}]}' \ --expected_lb_policy='round_robin' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -125,7 +127,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:443,False' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -133,7 +135,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:443,False' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -141,7 +143,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:443,False' \ --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"CppService","waitForReady":true}]}]}' \ --expected_lb_policy='round_robin' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -149,7 +151,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:443,False' \ --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"AlwaysPickedService","waitForReady":true}]}]}' \ --expected_lb_policy='round_robin' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -157,7 +159,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:1234,True;1.2.3.4:443,False' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -165,7 +167,7 @@ $FLAGS_test_bin_path \ --expected_addrs='[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1002]:443,False' \ --expected_chosen_service_config='' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 $FLAGS_test_bin_path \ @@ -173,7 +175,7 @@ $FLAGS_test_bin_path \ --expected_addrs='1.2.3.4:443,False' \ --expected_chosen_service_config='{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooThree","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFour","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFive","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSix","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSeven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEight","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooNine","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTen","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEleven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]}]}' \ --expected_lb_policy='' \ - --local_dns_server_address="127.0.0.1:$FLAGS_test_dns_server_port" & + --local_dns_server_address="127.0.0.1:$FLAGS_dns_server_port" & wait "$!" || EXIT_CODE=1 kill -SIGTERM "$DNS_SERVER_PID" || true diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc index 306c322780..b2a7890549 100644 --- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc +++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc @@ -102,14 +102,18 @@ namespace testing { void InvokeResolverComponentTestsRunner(std::string test_runner_bin_path, std::string test_bin_path, std::string dns_server_bin_path, - std::string records_config_path) { - int test_dns_server_port = grpc_pick_unused_port_or_die(); - - SubProcess* test_driver = new SubProcess( - {test_runner_bin_path, "--test_bin_path=" + test_bin_path, - "--dns_server_bin_path=" + dns_server_bin_path, - "--records_config_path=" + records_config_path, - "--test_dns_server_port=" + std::to_string(test_dns_server_port)}); + std::string records_config_path, + std::string dns_resolver_bin_path, + std::string tcp_connect_bin_path) { + int dns_server_port = grpc_pick_unused_port_or_die(); + + SubProcess* test_driver = + new SubProcess({test_runner_bin_path, "--test_bin_path=" + test_bin_path, + "--dns_server_bin_path=" + dns_server_bin_path, + "--records_config_path=" + records_config_path, + "--dns_server_port=" + std::to_string(dns_server_port), + "--dns_resolver_bin_path=" + dns_resolver_bin_path, + "--tcp_connect_bin_path=" + tcp_connect_bin_path}); gpr_mu test_driver_mu; gpr_mu_init(&test_driver_mu); gpr_cv test_driver_cv; @@ -170,8 +174,9 @@ int main(int argc, char** argv) { // sure that we're using bazel's test environment. grpc::testing::InvokeResolverComponentTestsRunner( bin_dir + "/resolver_component_tests_runner", - bin_dir + "/" + FLAGS_test_bin_name, bin_dir + "/test_dns_server", - bin_dir + "/resolver_test_record_groups.yaml"); + bin_dir + "/" + FLAGS_test_bin_name, bin_dir + "/utils/dns_server", + bin_dir + "/resolver_test_record_groups.yaml", + bin_dir + "/utils/dns_resolver", bin_dir + "/utils/tcp_connect"); } else { // Get the current binary's directory relative to repo root to invoke the // correct build config (asan/tsan/dbg, etc.). @@ -180,8 +185,10 @@ int main(int argc, char** argv) { grpc::testing::InvokeResolverComponentTestsRunner( "test/cpp/naming/resolver_component_tests_runner.sh", bin_dir + "/" + FLAGS_test_bin_name, - "test/cpp/naming/test_dns_server.py", - "test/cpp/naming/resolver_test_record_groups.yaml"); + "test/cpp/naming/utils/dns_server.py", + "test/cpp/naming/resolver_test_record_groups.yaml", + "test/cpp/naming/utils/dns_resolver.py", + "test/cpp/naming/utils/tcp_connect.py"); } grpc_shutdown(); return 0; diff --git a/test/cpp/naming/utils/BUILD b/test/cpp/naming/utils/BUILD new file mode 100644 index 0000000000..e7b6bc5fe7 --- /dev/null +++ b/test/cpp/naming/utils/BUILD @@ -0,0 +1,50 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) + +licenses(["notice"]) # Apache v2 + +load("//bazel:grpc_build_system.bzl", "grpc_py_binary") + +grpc_py_binary( + name = "dns_server", + srcs = ["dns_server.py"], + testonly = True, + external_deps = [ + "twisted", + "yaml", + ] +) + +grpc_py_binary( + name = "dns_resolver", + srcs = ["dns_resolver.py"], + testonly = True, + external_deps = [ + "twisted", + ] +) + +grpc_py_binary( + name = "tcp_connect", + srcs = ["tcp_connect.py"], + testonly = True, +) diff --git a/test/cpp/naming/utils/dns_resolver.py b/test/cpp/naming/utils/dns_resolver.py new file mode 100755 index 0000000000..6b272444e7 --- /dev/null +++ b/test/cpp/naming/utils/dns_resolver.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python2.7 +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Makes DNS queries for A records to specified servers""" + +import argparse +import signal +import twisted.internet.task as task +import twisted.names.client as client + +def main(): + argp = argparse.ArgumentParser(description='Make DNS queries for A records') + argp.add_argument('-s', '--server_host', default='127.0.0.1', type=str, + help='Host for DNS server to listen on for TCP and UDP.') + argp.add_argument('-p', '--server_port', default=53, type=int, + help='Port that the DNS server is listening on.') + argp.add_argument('-n', '--qname', default=None, type=str, + help=('Name of the record to query for. ')) + argp.add_argument('-t', '--timeout', default=1, type=int, + help=('Force process exit after this number of seconds.')) + args = argp.parse_args() + signal.alarm(args.timeout) + def OnResolverResultAvailable(result): + answers, authority, additional = result + for a in answers: + print(a.payload) + def BeginQuery(reactor, qname): + servers = [(args.server_host, args.server_port)] + resolver = client.Resolver(servers=servers) + deferred_result = resolver.lookupAddress(args.qname) + deferred_result.addCallback(OnResolverResultAvailable) + return deferred_result + task.react(BeginQuery, [args.qname]) + +if __name__ == '__main__': + main() diff --git a/test/cpp/naming/test_dns_server.py b/test/cpp/naming/utils/dns_server.py index 9f42f65ee6..9f42f65ee6 100755 --- a/test/cpp/naming/test_dns_server.py +++ b/test/cpp/naming/utils/dns_server.py diff --git a/test/cpp/naming/utils/tcp_connect.py b/test/cpp/naming/utils/tcp_connect.py new file mode 100755 index 0000000000..bf7455e3c2 --- /dev/null +++ b/test/cpp/naming/utils/tcp_connect.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python2.7 +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Opens a TCP connection to a specified server and then exits.""" + +import argparse +import signal +import socket + +def main(): + argp = argparse.ArgumentParser(description='Open a TCP handshake to a server') + argp.add_argument('-s', '--server_host', default=None, type=str, + help='Server host name or IP.') + argp.add_argument('-p', '--server_port', default=0, type=int, + help='Port that the server is listening on.') + argp.add_argument('-t', '--timeout', default=1, type=int, + help='Force process exit after this number of seconds.') + args = argp.parse_args() + signal.alarm(args.timeout) + socket.create_connection([args.server_host, args.server_port]) + +if __name__ == '__main__': + main() diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index d0190de172..5faa7ba757 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -16,14 +16,14 @@ * */ -#include <grpc++/channel.h> -#include <grpc++/create_channel.h> -#include <grpc++/impl/grpc_library.h> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/impl/grpc_library.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include <gtest/gtest.h> #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc index fb1e0608c5..a4fd9de820 100644 --- a/test/cpp/qps/benchmark_config.cc +++ b/test/cpp/qps/benchmark_config.cc @@ -18,9 +18,9 @@ #include "test/cpp/qps/benchmark_config.h" #include <gflags/gflags.h> -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> #include <grpc/support/log.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> DEFINE_bool(enable_log_reporter, true, "Enable reporting of benchmark results through GprLog"); diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 82c6361abd..77743a1dee 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -24,12 +24,12 @@ #include <unordered_map> #include <vector> -#include <grpc++/channel.h> -#include <grpc++/support/byte_buffer.h> -#include <grpc++/support/channel_arguments.h> -#include <grpc++/support/slice.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/support/byte_buffer.h> +#include <grpcpp/support/channel_arguments.h> +#include <grpcpp/support/slice.h> #include "src/proto/grpc/testing/payloads.pb.h" #include "src/proto/grpc/testing/services.grpc.pb.h" diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 8215ecbf55..f9bef91da0 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -26,13 +26,13 @@ #include <thread> #include <vector> -#include <grpc++/alarm.h> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/generic/generic_stub.h> #include <grpc/grpc.h> #include <grpc/support/cpu.h> #include <grpc/support/log.h> +#include <grpcpp/alarm.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/generic/generic_stub.h> #include "src/core/lib/surface/completion_queue.h" #include "src/proto/grpc/testing/services.grpc.pb.h" diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 8c1d9417fa..5185eef710 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -24,14 +24,14 @@ #include <thread> #include <vector> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/core/lib/gpr/host_port.h" #include "src/core/lib/profiling/timers.h" diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 4e0d266d77..361ee4346f 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -23,12 +23,12 @@ #include <unordered_map> #include <vector> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> #include "src/core/lib/gpr/env.h" #include "src/core/lib/gpr/host_port.h" diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h index 9c48066c9c..ce4bf3d30c 100644 --- a/test/cpp/qps/interarrival.h +++ b/test/cpp/qps/interarrival.h @@ -24,7 +24,7 @@ #include <random> #include <vector> -#include <grpc++/support/config.h> +#include <grpcpp/support/config.h> namespace grpc { namespace testing { diff --git a/test/cpp/qps/parse_json.h b/test/cpp/qps/parse_json.h index f2fffb52d4..089d9989ba 100644 --- a/test/cpp/qps/parse_json.h +++ b/test/cpp/qps/parse_json.h @@ -19,8 +19,8 @@ #ifndef TEST_QPS_PARSE_JSON_H #define TEST_QPS_PARSE_JSON_H -#include <grpc++/impl/codegen/config_protobuf.h> -#include <grpc++/support/config.h> +#include <grpcpp/impl/codegen/config_protobuf.h> +#include <grpcpp/support/config.h> namespace grpc { namespace testing { diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc index b2449da69c..0ff692255c 100644 --- a/test/cpp/qps/qps_json_driver.cc +++ b/test/cpp/qps/qps_json_driver.cc @@ -21,7 +21,7 @@ #include <memory> #include <set> -#include <grpc++/impl/codegen/config_protobuf.h> +#include <grpcpp/impl/codegen/config_protobuf.h> #include <gflags/gflags.h> #include <grpc/support/log.h> diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index 215a7bfbc9..aaffb1d93e 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -25,14 +25,14 @@ #include <thread> #include <vector> -#include <grpc++/client_context.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/cpu.h> #include <grpc/support/log.h> +#include <grpcpp/client_context.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/core/lib/gpr/host_port.h" #include "src/proto/grpc/testing/services.pb.h" diff --git a/test/cpp/qps/qps_worker.h b/test/cpp/qps/qps_worker.h index a5167426d0..3a8796ee5a 100644 --- a/test/cpp/qps/qps_worker.h +++ b/test/cpp/qps/qps_worker.h @@ -21,10 +21,10 @@ #include <memory> -#include <grpc++/server.h> -#include <grpc++/support/channel_arguments.h> -#include <grpc++/support/config.h> #include <grpc/support/atm.h> +#include <grpcpp/server.h> +#include <grpcpp/support/channel_arguments.h> +#include <grpcpp/support/config.h> #include "test/cpp/qps/server.h" diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index c5e90bd9a4..0a2565d463 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -25,7 +25,7 @@ #include "test/cpp/qps/parse_json.h" #include "test/cpp/qps/stats.h" -#include <grpc++/client_context.h> +#include <grpcpp/client_context.h> #include "src/cpp/util/core_stats.h" #include "src/proto/grpc/testing/services.grpc.pb.h" diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h index 1d7b2b54e7..c5dd138353 100644 --- a/test/cpp/qps/report.h +++ b/test/cpp/qps/report.h @@ -23,11 +23,11 @@ #include <set> #include <vector> -#include <grpc++/support/config.h> +#include <grpcpp/support/config.h> #include "test/cpp/qps/driver.h" -#include <grpc++/channel.h> +#include <grpcpp/channel.h> #include "src/proto/grpc/testing/services.grpc.pb.h" namespace grpc { diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index d772e709de..6b1ef93617 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -19,11 +19,11 @@ #ifndef TEST_QPS_SERVER_H #define TEST_QPS_SERVER_H -#include <grpc++/resource_quota.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server_builder.h> #include <grpc/support/cpu.h> #include <grpc/support/log.h> +#include <grpcpp/resource_quota.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server_builder.h> #include <vector> #include "src/cpp/util/core_stats.h" diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index f1dfea24d8..9cb05cd1d1 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -23,16 +23,16 @@ #include <mutex> #include <thread> -#include <grpc++/generic/async_generic_service.h> -#include <grpc++/resource_quota.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> -#include <grpc++/support/config.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include <grpcpp/generic/async_generic_service.h> +#include <grpcpp/resource_quota.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> +#include <grpcpp/support/config.h> #include "src/core/lib/gpr/host_port.h" #include "src/core/lib/surface/completion_queue.h" diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 19cbb53445..9dfd362055 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -19,11 +19,11 @@ #include <atomic> #include <thread> -#include <grpc++/security/server_credentials.h> -#include <grpc++/server.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/server.h> +#include <grpcpp/server_context.h> #include "src/core/lib/gpr/host_port.h" #include "src/proto/grpc/testing/services.grpc.pb.h" diff --git a/test/cpp/server/server_builder_test.cc b/test/cpp/server/server_builder_test.cc index 694ce549c0..2752b5838c 100644 --- a/test/cpp/server/server_builder_test.cc +++ b/test/cpp/server/server_builder_test.cc @@ -16,11 +16,11 @@ * */ -#include <grpc++/impl/codegen/config.h> +#include <grpcpp/impl/codegen/config.h> #include <gtest/gtest.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include <grpc/grpc.h> diff --git a/test/cpp/server/server_request_call_test.cc b/test/cpp/server/server_request_call_test.cc index b0a2fa444c..9831c06176 100644 --- a/test/cpp/server/server_request_call_test.cc +++ b/test/cpp/server/server_request_call_test.cc @@ -18,13 +18,13 @@ #include <thread> -#include <grpc++/impl/codegen/config.h> +#include <grpcpp/impl/codegen/config.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> #include <grpc/support/log.h> diff --git a/test/cpp/test/server_context_test_spouse_test.cc b/test/cpp/test/server_context_test_spouse_test.cc index d1dc9d7cac..e199a0fe3d 100644 --- a/test/cpp/test/server_context_test_spouse_test.cc +++ b/test/cpp/test/server_context_test_spouse_test.cc @@ -16,12 +16,12 @@ * */ -#include <grpc++/test/server_context_test_spouse.h> +#include <grpcpp/test/server_context_test_spouse.h> #include <cstring> #include <vector> -#include <grpc++/impl/grpc_library.h> +#include <grpcpp/impl/grpc_library.h> #include <gtest/gtest.h> namespace grpc { diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index 8282d46694..7a95a9f17d 100644 --- a/test/cpp/thread_manager/thread_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -16,14 +16,15 @@ *is % allowed in string */ +#include <inttypes.h> #include <ctime> #include <memory> #include <string> #include <gflags/gflags.h> -#include <grpc++/grpc++.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> +#include <grpcpp/grpcpp.h> #include "src/cpp/thread_manager/thread_manager.h" #include "test/cpp/util/test_config.h" diff --git a/test/cpp/util/byte_buffer_proto_helper.h b/test/cpp/util/byte_buffer_proto_helper.h index 1a9955e38c..94603db110 100644 --- a/test/cpp/util/byte_buffer_proto_helper.h +++ b/test/cpp/util/byte_buffer_proto_helper.h @@ -21,8 +21,8 @@ #include <memory> -#include <grpc++/impl/codegen/config_protobuf.h> -#include <grpc++/support/byte_buffer.h> +#include <grpcpp/impl/codegen/config_protobuf.h> +#include <grpcpp/support/byte_buffer.h> namespace grpc { namespace testing { diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc index d603b289c8..605ef15123 100644 --- a/test/cpp/util/byte_buffer_test.cc +++ b/test/cpp/util/byte_buffer_test.cc @@ -16,14 +16,14 @@ * */ -#include <grpc++/support/byte_buffer.h> +#include <grpcpp/support/byte_buffer.h> #include <cstring> #include <vector> -#include <grpc++/support/slice.h> #include <grpc/grpc.h> #include <grpc/slice.h> +#include <grpcpp/support/slice.h> #include <gtest/gtest.h> namespace grpc { diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index 6fc22f35ca..a3992ab278 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -20,12 +20,12 @@ #include <iostream> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/support/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/slice.h> #include <grpc/support/log.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/support/byte_buffer.h> namespace grpc { namespace testing { diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index eff18ee318..51ffafd29f 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -21,11 +21,11 @@ #include <map> -#include <grpc++/channel.h> -#include <grpc++/completion_queue.h> -#include <grpc++/generic/generic_stub.h> -#include <grpc++/support/status.h> -#include <grpc++/support/string_ref.h> +#include <grpcpp/channel.h> +#include <grpcpp/completion_queue.h> +#include <grpcpp/generic/generic_stub.h> +#include <grpcpp/support/status.h> +#include <grpcpp/support/string_ref.h> namespace grpc { diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index e54cc8528f..516f3fa53d 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -18,13 +18,13 @@ #include "test/cpp/util/cli_call.h" -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include <gtest/gtest.h> #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/util/cli_credentials.h b/test/cpp/util/cli_credentials.h index 469e8c54e6..b1358e77d8 100644 --- a/test/cpp/util/cli_credentials.h +++ b/test/cpp/util/cli_credentials.h @@ -19,8 +19,8 @@ #ifndef GRPC_TEST_CPP_UTIL_CLI_CREDENTIALS_H #define GRPC_TEST_CPP_UTIL_CLI_CREDENTIALS_H -#include <grpc++/security/credentials.h> -#include <grpc++/support/config.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/support/config.h> namespace grpc { namespace testing { diff --git a/test/cpp/util/config_grpc_cli.h b/test/cpp/util/config_grpc_cli.h index c157aab25a..358884196d 100644 --- a/test/cpp/util/config_grpc_cli.h +++ b/test/cpp/util/config_grpc_cli.h @@ -19,7 +19,7 @@ #ifndef GRPC_TEST_CPP_UTIL_CONFIG_GRPC_CLI_H #define GRPC_TEST_CPP_UTIL_CONFIG_GRPC_CLI_H -#include <grpc++/impl/codegen/config_protobuf.h> +#include <grpcpp/impl/codegen/config_protobuf.h> #ifndef GRPC_CUSTOM_DYNAMICMESSAGEFACTORY #include <google/protobuf/dynamic_message.h> diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index 4d047473b9..1047d44627 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -18,9 +18,9 @@ #include "test/cpp/util/create_test_channel.h" -#include <grpc++/create_channel.h> -#include <grpc++/security/credentials.h> #include <grpc/support/log.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/security/credentials.h> #include "test/cpp/util/test_credentials_provider.h" diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h index e2ca8f99b4..ddaa99f43e 100644 --- a/test/cpp/util/create_test_channel.h +++ b/test/cpp/util/create_test_channel.h @@ -21,7 +21,7 @@ #include <memory> -#include <grpc++/security/credentials.h> +#include <grpcpp/security/credentials.h> namespace grpc { class Channel; diff --git a/test/cpp/util/error_details_test.cc b/test/cpp/util/error_details_test.cc index 16a00fb201..f71dfc0df9 100644 --- a/test/cpp/util/error_details_test.cc +++ b/test/cpp/util/error_details_test.cc @@ -16,7 +16,7 @@ * */ -#include <grpc++/support/error_details.h> +#include <grpcpp/support/error_details.h> #include <gtest/gtest.h> #include "src/proto/grpc/status/status.pb.h" diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 67359434a2..10e13d929b 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -58,7 +58,7 @@ #include <iostream> #include <gflags/gflags.h> -#include <grpc++/support/config.h> +#include <grpcpp/support/config.h> #include "test/cpp/util/cli_credentials.h" #include "test/cpp/util/grpc_tool.h" #include "test/cpp/util/test_config.h" diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index e9dd7512c4..195b6bd304 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -27,13 +27,13 @@ #include <thread> #include <gflags/gflags.h> -#include <grpc++/channel.h> -#include <grpc++/create_channel.h> -#include <grpc++/grpc++.h> -#include <grpc++/security/credentials.h> -#include <grpc++/support/string_ref.h> #include <grpc/grpc.h> #include <grpc/support/port_platform.h> +#include <grpcpp/channel.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/grpcpp.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/support/string_ref.h> #include "test/cpp/util/cli_call.h" #include "test/cpp/util/proto_file_parser.h" diff --git a/test/cpp/util/grpc_tool.h b/test/cpp/util/grpc_tool.h index a10422f882..fb53af77c8 100644 --- a/test/cpp/util/grpc_tool.h +++ b/test/cpp/util/grpc_tool.h @@ -21,7 +21,7 @@ #include <functional> -#include <grpc++/support/config.h> +#include <grpcpp/support/config.h> #include "test/cpp/util/cli_credentials.h" diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc index 135cfdc1f3..9f7fec5e93 100644 --- a/test/cpp/util/grpc_tool_test.cc +++ b/test/cpp/util/grpc_tool_test.cc @@ -21,14 +21,14 @@ #include <sstream> #include <gflags/gflags.h> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/create_channel.h> -#include <grpc++/ext/proto_server_reflection_plugin.h> -#include <grpc++/server.h> -#include <grpc++/server_builder.h> -#include <grpc++/server_context.h> #include <grpc/grpc.h> +#include <grpcpp/channel.h> +#include <grpcpp/client_context.h> +#include <grpcpp/create_channel.h> +#include <grpcpp/ext/proto_server_reflection_plugin.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> #include <gtest/gtest.h> #include "src/core/lib/gpr/env.h" diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc index 5982815dd7..a058206506 100644 --- a/test/cpp/util/metrics_server.cc +++ b/test/cpp/util/metrics_server.cc @@ -18,9 +18,9 @@ #include "test/cpp/util/metrics_server.h" -#include <grpc++/server.h> -#include <grpc++/server_builder.h> #include <grpc/support/log.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> #include "src/proto/grpc/testing/metrics.grpc.pb.h" #include "src/proto/grpc/testing/metrics.pb.h" diff --git a/test/cpp/util/proto_file_parser.cc b/test/cpp/util/proto_file_parser.cc index e2c8b05220..3fc96f38ae 100644 --- a/test/cpp/util/proto_file_parser.cc +++ b/test/cpp/util/proto_file_parser.cc @@ -23,7 +23,7 @@ #include <sstream> #include <unordered_set> -#include <grpc++/support/config.h> +#include <grpcpp/support/config.h> namespace grpc { namespace testing { diff --git a/test/cpp/util/proto_file_parser.h b/test/cpp/util/proto_file_parser.h index 35f3782f14..2236b59451 100644 --- a/test/cpp/util/proto_file_parser.h +++ b/test/cpp/util/proto_file_parser.h @@ -21,7 +21,7 @@ #include <memory> -#include <grpc++/channel.h> +#include <grpcpp/channel.h> #include "test/cpp/util/config_grpc_cli.h" #include "test/cpp/util/proto_reflection_descriptor_database.h" diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index a6776c2a86..e4cf2f207e 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -23,8 +23,8 @@ #include <unordered_set> #include <vector> -#include <grpc++/grpc++.h> -#include <grpc++/impl/codegen/config_protobuf.h> +#include <grpcpp/grpcpp.h> +#include <grpcpp/impl/codegen/config_protobuf.h> #include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h" namespace grpc { diff --git a/test/cpp/util/service_describer.h b/test/cpp/util/service_describer.h index b7ab7578b4..f7ef50c7bb 100644 --- a/test/cpp/util/service_describer.h +++ b/test/cpp/util/service_describer.h @@ -19,7 +19,7 @@ #ifndef GRPC_TEST_CPP_UTIL_SERVICE_DESCRIBER_H #define GRPC_TEST_CPP_UTIL_SERVICE_DESCRIBER_H -#include <grpc++/support/config.h> +#include <grpcpp/support/config.h> #include "test/cpp/util/config_grpc_cli.h" namespace grpc { diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc index 5f0b9c17cc..8e06062360 100644 --- a/test/cpp/util/slice_test.cc +++ b/test/cpp/util/slice_test.cc @@ -16,7 +16,7 @@ * */ -#include <grpc++/support/slice.h> +#include <grpcpp/support/slice.h> #include <grpc/grpc.h> #include <grpc/slice.h> diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc index 1047cdb50e..2188723db8 100644 --- a/test/cpp/util/status_test.cc +++ b/test/cpp/util/status_test.cc @@ -16,7 +16,7 @@ * */ -#include <grpc++/support/status.h> +#include <grpcpp/support/status.h> #include <grpc/status.h> #include <grpc/support/log.h> diff --git a/test/cpp/util/string_ref_helper.h b/test/cpp/util/string_ref_helper.h index e4cb71ad05..707767de07 100644 --- a/test/cpp/util/string_ref_helper.h +++ b/test/cpp/util/string_ref_helper.h @@ -19,7 +19,7 @@ #ifndef GRPC_TEST_CPP_UTIL_STRING_REF_HELPER_H #define GRPC_TEST_CPP_UTIL_STRING_REF_HELPER_H -#include <grpc++/support/string_ref.h> +#include <grpcpp/support/string_ref.h> namespace grpc { namespace testing { diff --git a/test/cpp/util/string_ref_test.cc b/test/cpp/util/string_ref_test.cc index 3f62760f76..8f7986e64e 100644 --- a/test/cpp/util/string_ref_test.cc +++ b/test/cpp/util/string_ref_test.cc @@ -16,7 +16,7 @@ * */ -#include <grpc++/support/string_ref.h> +#include <grpcpp/support/string_ref.h> #include <string.h> diff --git a/test/cpp/util/test_credentials_provider.h b/test/cpp/util/test_credentials_provider.h index 6f8f768d6b..f489a2c563 100644 --- a/test/cpp/util/test_credentials_provider.h +++ b/test/cpp/util/test_credentials_provider.h @@ -21,9 +21,9 @@ #include <memory> -#include <grpc++/security/credentials.h> -#include <grpc++/security/server_credentials.h> -#include <grpc++/support/channel_arguments.h> +#include <grpcpp/security/credentials.h> +#include <grpcpp/security/server_credentials.h> +#include <grpcpp/support/channel_arguments.h> namespace grpc { namespace testing { diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 73ec44c2a5..a8851a583d 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -16,8 +16,8 @@ * */ -#include <grpc++/support/time.h> #include <grpc/support/time.h> +#include <grpcpp/support/time.h> #include <gtest/gtest.h> using std::chrono::duration_cast; |