From f4e55b85bca4f9fddab866f920c71c4c0a39a6be Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 8 Feb 2021 13:38:32 -0800 Subject: [PATCH 1/4] Replace disrespectful term --- examples/python/xds/server.py | 2 +- src/compiler/cpp_generator.cc | 2 +- .../dns/c_ares/grpc_ares_ev_driver_posix.cc | 4 +- .../resolver/dns/c_ares/grpc_ares_wrapper.cc | 8 +- .../filters/client_idle/client_idle_filter.cc | 2 +- src/core/ext/transport/cronet/BUILD | 2 +- ...ronet_api_dummy.cc => cronet_api_phony.cc} | 2 +- src/core/lib/gpr/sync_windows.cc | 4 +- src/core/lib/gprpp/thd.h | 2 +- src/core/lib/iomgr/buffer_list.h | 2 +- src/core/lib/iomgr/cfstream_handle.cc | 4 +- src/core/lib/iomgr/error.h | 2 +- src/core/lib/iomgr/ev_apple.cc | 2 +- src/core/lib/iomgr/ev_epoll1_linux.cc | 6 +- src/core/lib/iomgr/ev_posix.cc | 6 +- src/core/lib/iomgr/tcp_uv.cc | 4 +- src/core/lib/iomgr/wakeup_fd_nospecial.cc | 2 +- src/cpp/server/server_cc.cc | 6 +- src/cpp/server/server_context.cc | 2 +- src/csharp/Grpc.Tools.Tests/GeneratorTest.cs | 2 +- .../tests/PluginTest/imported-with-dash.proto | 2 +- .../tests/PluginTest/test-dash-filename.proto | 4 +- src/objective-c/tests/UnitTests/APIv2Tests.m | 6 +- .../tests/UnitTests/ChannelPoolTest.m | 14 +- .../tests/UnitTests/ChannelTests.m | 22 +-- .../tests/UnitTests/GRPCClientTests.m | 14 +- .../tests/UnitTests/TransportTests.m | 16 +-- .../AbstractGeneratedCodeTest.php | 8 +- .../tests/unit_tests/CallCredentials2Test.php | 8 +- .../tests/unit_tests/CallCredentialsTest.php | 4 +- src/php/tests/unit_tests/CallInvokerTest.php | 4 +- src/php/tests/unit_tests/EndToEndTest.php | 42 +++--- src/php/tests/unit_tests/InterceptorTest.php | 20 +-- .../tests/unit_tests/SecureEndToEndTest.php | 12 +- src/php/tests/unit_tests/ServerTest.php | 4 +- src/proto/grpc/testing/xds/v3/ads.proto | 2 +- .../tests/unit/_metadata_flags_test.py | 8 +- .../grpcio_tests/tests_aio/unit/abort_test.py | 2 +- .../grpcio_tests/tests_aio/unit/init_test.py | 4 +- .../unit/wait_for_connection_test.py | 12 +- src/ruby/end2end/grpc_class_init_client.rb | 2 +- .../end2end/load_grpc_with_gc_stress_test.rb | 2 +- .../multiple_killed_watching_threads_test.rb | 2 +- src/ruby/ext/grpc/rb_compression_options.c | 2 +- src/ruby/ext/grpc/rb_enable_cpp.cc | 2 +- src/ruby/spec/call_spec.rb | 2 +- src/ruby/spec/channel_spec.rb | 12 +- src/ruby/spec/generic/active_call_spec.rb | 4 +- .../channel/minimal_stack_is_minimal_test.cc | 2 +- .../dns_resolver_connectivity_test.cc | 8 +- test/core/end2end/fixtures/inproc.cc | 2 +- test/core/end2end/inproc_callback_test.cc | 2 +- test/core/iomgr/fd_posix_test.cc | 2 +- .../ios/CFStreamTests/CFStreamClientTests.mm | 4 +- .../CFStreamTests/CFStreamEndpointTests.mm | 4 +- test/core/iomgr/sockaddr_utils_test.cc | 36 ++--- test/core/iomgr/tcp_client_posix_test.cc | 2 +- test/core/iomgr/tcp_client_uv_test.cc | 2 +- test/core/security/credentials_test.cc | 8 +- test/core/security/etc/README | 2 +- .../transport/chttp2/context_list_test.cc | 8 +- test/cpp/end2end/async_end2end_test.cc | 12 +- .../end2end/client_callback_end2end_test.cc | 50 +++---- .../client_interceptors_end2end_test.cc | 126 +++++++++--------- test/cpp/end2end/end2end_test.cc | 26 ++-- test/cpp/end2end/interceptors_util.cc | 12 +- test/cpp/end2end/interceptors_util.h | 12 +- .../server_interceptors_end2end_test.cc | 70 +++++----- .../ios/CronetTests/CppCronetEnd2EndTests.mm | 8 +- test/cpp/ios/CronetTests/TestHelper.h | 8 +- test/cpp/ios/CronetTests/TestHelper.mm | 10 +- test/cpp/microbenchmarks/bm_call_create.cc | 34 ++--- .../microbenchmarks/bm_chttp2_transport.cc | 22 +-- test/cpp/microbenchmarks/bm_cq.cc | 8 +- test/cpp/naming/resolver_component_test.cc | 18 +-- test/cpp/qps/driver.cc | 4 +- test/cpp/qps/report.cc | 4 +- test/cpp/qps/server_sync.cc | 4 +- test/cpp/util/grpc_tool_test.cc | 4 +- test/distrib/php/distribtest.php | 2 +- 80 files changed, 409 insertions(+), 409 deletions(-) rename src/core/ext/transport/cronet/transport/{cronet_api_dummy.cc => cronet_api_phony.cc} (97%) diff --git a/examples/python/xds/server.py b/examples/python/xds/server.py index 75043857f3b..196e2c11f3a 100644 --- a/examples/python/xds/server.py +++ b/examples/python/xds/server.py @@ -29,7 +29,7 @@ from grpc_health.v1 import health from grpc_health.v1 import health_pb2 from grpc_health.v1 import health_pb2_grpc -_DESCRIPTION = "A general purpose dummy server." +_DESCRIPTION = "A general purpose phony server." class Greeter(helloworld_pb2_grpc.GreeterServicer): diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 1e0490a5ef3..c78a3e08e22 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -762,7 +762,7 @@ void PrintHeaderClientMethodCallbackEnd( printer->Indent(); printer->Print("friend class Stub;\n"); printer->Print("explicit experimental_async(Stub* stub): stub_(stub) { }\n"); - // include a function with a dummy use of stub_ to avoid an unused + // include a function with a phony use of stub_ to avoid an unused // private member warning for service with no methods printer->Print("Stub* stub() { return stub_; }\n"); printer->Print("Stub* stub_;\n"); diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc index ff18f768a47..07f38ba59ab 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc @@ -54,8 +54,8 @@ class GrpcPolledFdPosix : public GrpcPolledFd { /* c-ares library will close the fd inside grpc_fd. This fd may be picked up immediately by another thread, and should not be closed by the following grpc_fd_orphan. */ - int dummy_release_fd; - grpc_fd_orphan(fd_, nullptr, &dummy_release_fd, "c-ares query finished"); + int phony_release_fd; + grpc_fd_orphan(fd_, nullptr, &phony_release_fd, "c-ares query finished"); } void RegisterForOnReadableLocked(grpc_closure* read_closure) override { diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc index 237b890ea3f..e45c58c92c1 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc @@ -238,14 +238,14 @@ void grpc_ares_ev_driver_shutdown_locked(grpc_ares_ev_driver* ev_driver) { // Search fd in the fd_node list head. This is an O(n) search, the max possible // value of n is ARES_GETSOCK_MAXNUM (16). n is typically 1 - 2 in our tests. static fd_node* pop_fd_node_locked(fd_node** head, ares_socket_t as) { - fd_node dummy_head; - dummy_head.next = *head; - fd_node* node = &dummy_head; + fd_node phony_head; + phony_head.next = *head; + fd_node* node = &phony_head; while (node->next != nullptr) { if (node->next->grpc_polled_fd->GetWrappedAresSocketLocked() == as) { fd_node* ret = node->next; node->next = node->next->next; - *head = dummy_head.next; + *head = phony_head.next; return ret; } node = node->next; diff --git a/src/core/ext/filters/client_idle/client_idle_filter.cc b/src/core/ext/filters/client_idle/client_idle_filter.cc index 2ea3eadeec3..e39dda4dd90 100644 --- a/src/core/ext/filters/client_idle/client_idle_filter.cc +++ b/src/core/ext/filters/client_idle/client_idle_filter.cc @@ -187,7 +187,7 @@ void ChannelData::StartTransportOp(grpc_channel_element* elem, ChannelData* chand = static_cast(elem->channel_data); // Catch the disconnect_with_error transport op. if (op->disconnect_with_error != nullptr) { - // IncreaseCallCount() introduces a dummy call and prevent the timer from + // IncreaseCallCount() introduces a phony call and prevent the timer from // being reset by other threads. chand->IncreaseCallCount(); // If the timer has been set, cancel the timer. diff --git a/src/core/ext/transport/cronet/BUILD b/src/core/ext/transport/cronet/BUILD index 51865d3bc3a..9c5848b2ab7 100644 --- a/src/core/ext/transport/cronet/BUILD +++ b/src/core/ext/transport/cronet/BUILD @@ -33,7 +33,7 @@ grpc_cc_library( name = "grpc_transport_cronet_client_secure", srcs = [ "client/secure/cronet_channel_create.cc", - "transport/cronet_api_dummy.cc", + "transport/cronet_api_phony.cc", "transport/cronet_status.cc", "transport/cronet_status.h", "transport/cronet_transport.cc", diff --git a/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc b/src/core/ext/transport/cronet/transport/cronet_api_phony.cc similarity index 97% rename from src/core/ext/transport/cronet/transport/cronet_api_dummy.cc rename to src/core/ext/transport/cronet/transport/cronet_api_phony.cc index 02825ed3c52..3063d06f6d1 100644 --- a/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc +++ b/src/core/ext/transport/cronet/transport/cronet_api_phony.cc @@ -30,7 +30,7 @@ library, so we can build it in all environments */ #ifdef GRPC_COMPILE_WITH_CRONET /* link with the real CRONET library in the build system */ #else -/* Dummy implementation of cronet API just to test for build-ability */ +/* Phony implementation of cronet API just to test for build-ability */ bidirectional_stream* bidirectional_stream_create( stream_engine* /*engine*/, void* /*annotation*/, bidirectional_stream_callback* /*callback*/) { diff --git a/src/core/lib/gpr/sync_windows.cc b/src/core/lib/gpr/sync_windows.cc index 64eec7c2e11..a6173c72e9a 100644 --- a/src/core/lib/gpr/sync_windows.cc +++ b/src/core/lib/gpr/sync_windows.cc @@ -100,7 +100,7 @@ void gpr_cv_broadcast(gpr_cv* cv) { WakeAllConditionVariable(cv); } /*----------------------------------------*/ -static void* dummy; +static void* phony; struct run_once_func_arg { void (*init_function)(void); }; @@ -113,7 +113,7 @@ static BOOL CALLBACK run_once_func(gpr_once* once, void* v, void** pv) { void gpr_once_init(gpr_once* once, void (*init_function)(void)) { struct run_once_func_arg arg; arg.init_function = init_function; - InitOnceExecuteOnce(once, run_once_func, &arg, &dummy); + InitOnceExecuteOnce(once, run_once_func, &arg, &phony); } #endif /* defined(GPR_WINDOWS) && !defined(GPR_ABSEIL_SYNC) && \ diff --git a/src/core/lib/gprpp/thd.h b/src/core/lib/gprpp/thd.h index 2e7135e94d9..c4ce04cec46 100644 --- a/src/core/lib/gprpp/thd.h +++ b/src/core/lib/gprpp/thd.h @@ -157,7 +157,7 @@ class Thread { Thread& operator=(const Thread&) = delete; /// The thread states are as follows: - /// FAKE -- just a dummy placeholder Thread created by the default constructor + /// FAKE -- just a phony placeholder Thread created by the default constructor /// ALIVE -- an actual thread of control exists associated with this thread /// STARTED -- the thread of control has been started /// DONE -- the thread of control has completed and been joined diff --git a/src/core/lib/iomgr/buffer_list.h b/src/core/lib/iomgr/buffer_list.h index f804f021a75..f8faf7cb087 100644 --- a/src/core/lib/iomgr/buffer_list.h +++ b/src/core/lib/iomgr/buffer_list.h @@ -146,7 +146,7 @@ class TracedBuffer { #else /* GRPC_LINUX_ERRQUEUE */ class TracedBuffer { public: - /* Dummy shutdown function */ + /* Phony shutdown function */ static void Shutdown(grpc_core::TracedBuffer** /*head*/, void* /*remaining*/, grpc_error* shutdown_err) { GRPC_ERROR_UNREF(shutdown_err); diff --git a/src/core/lib/iomgr/cfstream_handle.cc b/src/core/lib/iomgr/cfstream_handle.cc index 46914e5175a..2f70a2995be 100644 --- a/src/core/lib/iomgr/cfstream_handle.cc +++ b/src/core/lib/iomgr/cfstream_handle.cc @@ -202,9 +202,9 @@ void CFStreamHandle::Unref(const char* file, int line, const char* reason) { #else -/* Creating a dummy function so that the grpc_cfstream library will be +/* Creating a phony function so that the grpc_cfstream library will be * non-empty. */ -void CFStreamDummy() {} +void CFStreamPhony() {} #endif diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index ac3ff876289..ca520fa5678 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -219,7 +219,7 @@ static grpc_error* grpc_error_create_from_vector(const char* file, int line, grpc_error* grpc_error_set_int(grpc_error* src, grpc_error_ints which, intptr_t value) GRPC_MUST_USE_RESULT; -/// It is an error to pass nullptr as `p`. Caller should allocate a dummy +/// It is an error to pass nullptr as `p`. Caller should allocate a phony /// intptr_t for `p`, even if the value of `p` is not used. bool grpc_error_get_int(grpc_error* error, grpc_error_ints which, intptr_t* p); /// This call takes ownership of the slice; the error is responsible for diff --git a/src/core/lib/iomgr/ev_apple.cc b/src/core/lib/iomgr/ev_apple.cc index d1525828865..0bffe1f3538 100644 --- a/src/core/lib/iomgr/ev_apple.cc +++ b/src/core/lib/iomgr/ev_apple.cc @@ -20,7 +20,7 @@ /// is enabled (see iomgr_posix_cfstream.cc), a global thread is started to /// handle and trigger all the CFStream events. The CFStream streams register /// themselves with the run loop with functions grpc_apple_register_read_stream -/// and grpc_apple_register_read_stream. Pollsets are dummy and block on a +/// and grpc_apple_register_read_stream. Pollsets are phony and block on a /// condition variable in pollset_work(). #include diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 8a1013da21f..a8508701294 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -388,9 +388,9 @@ static void fd_shutdown_internal(grpc_fd* fd, grpc_error* why, if (!releasing_fd) { shutdown(fd->fd, SHUT_RDWR); } else { - /* we need a dummy event for earlier linux versions. */ - epoll_event dummy_event; - if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_DEL, fd->fd, &dummy_event) != + /* we need a phony event for earlier linux versions. */ + epoll_event phony_event; + if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_DEL, fd->fd, &phony_event) != 0) { gpr_log(GPR_ERROR, "epoll_ctl failed: %s", strerror(errno)); } diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index 3d32359be46..07aeb7f2478 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -89,7 +89,7 @@ namespace { grpc_poll_function_type real_poll_function; -int dummy_poll(struct pollfd fds[], nfds_t nfds, int timeout) { +int phony_poll(struct pollfd fds[], nfds_t nfds, int timeout) { if (timeout == 0) { return real_poll_function(fds, nfds, 0); } else { @@ -103,10 +103,10 @@ const grpc_event_engine_vtable* init_non_polling(bool explicit_request) { if (!explicit_request) { return nullptr; } - // return the simplest engine as a dummy but also override the poller + // return the simplest engine as a phony but also override the poller auto ret = grpc_init_poll_posix(explicit_request); real_poll_function = grpc_poll_function; - grpc_poll_function = dummy_poll; + grpc_poll_function = phony_poll; return ret; } diff --git a/src/core/lib/iomgr/tcp_uv.cc b/src/core/lib/iomgr/tcp_uv.cc index 942b7d60e45..e395b149265 100644 --- a/src/core/lib/iomgr/tcp_uv.cc +++ b/src/core/lib/iomgr/tcp_uv.cc @@ -252,8 +252,8 @@ static void accept_new_connection(grpc_custom_socket* socket) { uv_socket->accept_error = GRPC_ERROR_NONE; uv_socket->pending_connections -= 1; if (uv_socket->accept_error != GRPC_ERROR_NONE) { - uv_stream_t dummy_handle; - uv_accept((uv_stream_t*)uv_socket->handle, &dummy_handle); + uv_stream_t phony_handle; + uv_accept((uv_stream_t*)uv_socket->handle, &phony_handle); uv_socket->accept_cb(socket, new_socket, error); } else { uv_socket_t* uv_new_socket = (uv_socket_t*)gpr_malloc(sizeof(uv_socket_t)); diff --git a/src/core/lib/iomgr/wakeup_fd_nospecial.cc b/src/core/lib/iomgr/wakeup_fd_nospecial.cc index 64778929f00..b1565751ce3 100644 --- a/src/core/lib/iomgr/wakeup_fd_nospecial.cc +++ b/src/core/lib/iomgr/wakeup_fd_nospecial.cc @@ -17,7 +17,7 @@ */ /* - * This is a dummy file to provide an invalid specialized_wakeup_fd_vtable on + * This is a phony file to provide an invalid specialized_wakeup_fd_vtable on * systems without anything better than pipe. */ diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 3309f32dce1..1bc5acd4250 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -88,7 +88,7 @@ class ShutdownTag : public internal::CompletionQueueTag { } }; -class DummyTag : public internal::CompletionQueueTag { +class PhonyTag : public internal::CompletionQueueTag { public: bool FinalizeResult(void** /*tag*/, bool* /*status*/) override { return true; @@ -497,7 +497,7 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag { cq_.TryPluck(op_tag, gpr_inf_future(GPR_CLOCK_REALTIME)); /* Ensure the cq_ is shutdown */ - grpc::DummyTag ignored_tag; + grpc::PhonyTag ignored_tag; GPR_ASSERT(cq_.Pluck(&ignored_tag) == false); } delete this; @@ -1242,7 +1242,7 @@ void Server::ShutdownInternal(gpr_timespec deadline) { /// The completion queue to use for server shutdown completion notification grpc::CompletionQueue shutdown_cq; - grpc::ShutdownTag shutdown_tag; // Dummy shutdown tag + grpc::ShutdownTag shutdown_tag; // Phony shutdown tag grpc_server_shutdown_and_notify(server_, shutdown_cq.cq(), &shutdown_tag); shutdown_cq.Shutdown(); diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index cb9cf4308a6..33d58f721c8 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -126,7 +126,7 @@ class ServerContextBase::CompletionOp final // Unref can delete this, so do not access anything from this afterward. return; } - /* Start a dummy op so that we can return the tag */ + /* Start a phony op so that we can return the tag */ GPR_ASSERT(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag_, nullptr) == GRPC_CALL_OK); } diff --git a/src/csharp/Grpc.Tools.Tests/GeneratorTest.cs b/src/csharp/Grpc.Tools.Tests/GeneratorTest.cs index 8a8fc81aba5..5ccce90a13e 100644 --- a/src/csharp/Grpc.Tools.Tests/GeneratorTest.cs +++ b/src/csharp/Grpc.Tools.Tests/GeneratorTest.cs @@ -32,7 +32,7 @@ namespace Grpc.Tools.Tests public void SetUp() { _mockEngine = new Mock(); - _log = new TaskLoggingHelper(_mockEngine.Object, "dummy"); + _log = new TaskLoggingHelper(_mockEngine.Object, "phony"); } [TestCase("csharp")] diff --git a/src/objective-c/tests/PluginTest/imported-with-dash.proto b/src/objective-c/tests/PluginTest/imported-with-dash.proto index c01bbecc070..a0118286580 100644 --- a/src/objective-c/tests/PluginTest/imported-with-dash.proto +++ b/src/objective-c/tests/PluginTest/imported-with-dash.proto @@ -18,5 +18,5 @@ package grpc.testing; option objc_class_prefix = "RMT"; message TestMessageImported { - int32 dummy = 1; + int32 phony = 1; } diff --git a/src/objective-c/tests/PluginTest/test-dash-filename.proto b/src/objective-c/tests/PluginTest/test-dash-filename.proto index afbb6035df0..71bbe43ec80 100644 --- a/src/objective-c/tests/PluginTest/test-dash-filename.proto +++ b/src/objective-c/tests/PluginTest/test-dash-filename.proto @@ -20,8 +20,8 @@ option objc_class_prefix = "RMT"; import "imported-with-dash.proto"; message TestMessage { - int32 dummy = 1; + int32 phony = 1; } -service DummyService { +service PhonyService { } diff --git a/src/objective-c/tests/UnitTests/APIv2Tests.m b/src/objective-c/tests/UnitTests/APIv2Tests.m index b8b8b2677f1..1d769aa3177 100644 --- a/src/objective-c/tests/UnitTests/APIv2Tests.m +++ b/src/objective-c/tests/UnitTests/APIv2Tests.m @@ -430,10 +430,10 @@ static const NSTimeInterval kInvertedTimeout = 2; const double kMargin = 0.1; __weak XCTestExpectation *completion = [self expectationWithDescription:@"Timeout in a second."]; - NSString *const kDummyAddress = [NSString stringWithFormat:@"127.0.0.1:10000"]; + NSString *const kPhonyAddress = [NSString stringWithFormat:@"127.0.0.1:10000"]; GRPCRequestOptions *requestOptions = - [[GRPCRequestOptions alloc] initWithHost:kDummyAddress - path:@"/dummy/path" + [[GRPCRequestOptions alloc] initWithHost:kPhonyAddress + path:@"/phony/path" safety:GRPCCallSafetyDefault]; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; options.connectMinTimeout = timeout; diff --git a/src/objective-c/tests/UnitTests/ChannelPoolTest.m b/src/objective-c/tests/UnitTests/ChannelPoolTest.m index 0b1eca389b9..614fac179f5 100644 --- a/src/objective-c/tests/UnitTests/ChannelPoolTest.m +++ b/src/objective-c/tests/UnitTests/ChannelPoolTest.m @@ -24,9 +24,9 @@ #define TEST_TIMEOUT 32 -static NSString *kDummyHost = @"dummy.host"; -static NSString *kDummyHost2 = @"dummy.host.2"; -static NSString *kDummyPath = @"/dummy/path"; +static NSString *kPhonyHost = @"phony.host"; +static NSString *kPhonyHost2 = @"phony.host.2"; +static NSString *kPhonyPath = @"/phony/path"; @interface ChannelPoolTest : XCTestCase @@ -45,10 +45,10 @@ static NSString *kDummyPath = @"/dummy/path"; GRPCMutableCallOptions *options3 = [options1 mutableCopy]; options3.transportType = GRPCTransportTypeInsecure; - GRPCPooledChannel *channel1 = [pool channelWithHost:kDummyHost callOptions:options1]; - GRPCPooledChannel *channel2 = [pool channelWithHost:kDummyHost callOptions:options2]; - GRPCPooledChannel *channel3 = [pool channelWithHost:kDummyHost callOptions:options3]; - GRPCPooledChannel *channel4 = [pool channelWithHost:kDummyHost2 callOptions:options1]; + GRPCPooledChannel *channel1 = [pool channelWithHost:kPhonyHost callOptions:options1]; + GRPCPooledChannel *channel2 = [pool channelWithHost:kPhonyHost callOptions:options2]; + GRPCPooledChannel *channel3 = [pool channelWithHost:kPhonyHost callOptions:options3]; + GRPCPooledChannel *channel4 = [pool channelWithHost:kPhonyHost2 callOptions:options1]; XCTAssertNotNil(channel1); XCTAssertNotNil(channel2); diff --git a/src/objective-c/tests/UnitTests/ChannelTests.m b/src/objective-c/tests/UnitTests/ChannelTests.m index a4935ddb8cc..6c9b80f9e02 100644 --- a/src/objective-c/tests/UnitTests/ChannelTests.m +++ b/src/objective-c/tests/UnitTests/ChannelTests.m @@ -25,8 +25,8 @@ #import "../../GRPCClient/private/GRPCCore/GRPCCompletionQueue.h" #import "../../GRPCClient/private/GRPCCore/GRPCWrappedCall.h" -static NSString *kDummyHost = @"dummy.host"; -static NSString *kDummyPath = @"/dummy/path"; +static NSString *kPhonyHost = @"phony.host"; +static NSString *kPhonyPath = @"/phony/path"; @interface ChannelTests : XCTestCase @@ -40,11 +40,11 @@ static NSString *kDummyPath = @"/dummy/path"; - (void)testPooledChannelCreatingChannel { GRPCCallOptions *options = [[GRPCCallOptions alloc] init]; - GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost + GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kPhonyHost callOptions:options]; GRPCPooledChannel *channel = [[GRPCPooledChannel alloc] initWithChannelConfiguration:config]; GRPCCompletionQueue *cq = [GRPCCompletionQueue completionQueue]; - GRPCWrappedCall *wrappedCall = [channel wrappedCallWithPath:kDummyPath + GRPCWrappedCall *wrappedCall = [channel wrappedCallWithPath:kPhonyPath completionQueue:cq callOptions:options]; XCTAssertNotNil(channel.wrappedChannel); @@ -54,7 +54,7 @@ static NSString *kDummyPath = @"/dummy/path"; - (void)testTimedDestroyChannel { const NSTimeInterval kDestroyDelay = 1.0; GRPCCallOptions *options = [[GRPCCallOptions alloc] init]; - GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost + GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kPhonyHost callOptions:options]; GRPCPooledChannel *channel = [[GRPCPooledChannel alloc] initWithChannelConfiguration:config destroyDelay:kDestroyDelay]; @@ -62,14 +62,14 @@ static NSString *kDummyPath = @"/dummy/path"; GRPCWrappedCall *wrappedCall; GRPCChannel *wrappedChannel; @autoreleasepool { - wrappedCall = [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options]; + wrappedCall = [channel wrappedCallWithPath:kPhonyPath completionQueue:cq callOptions:options]; XCTAssertNotNil(channel.wrappedChannel); // Unref and ref channel immediately; expect using the same raw channel. wrappedChannel = channel.wrappedChannel; wrappedCall = nil; - wrappedCall = [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options]; + wrappedCall = [channel wrappedCallWithPath:kPhonyPath completionQueue:cq callOptions:options]; XCTAssertEqual(channel.wrappedChannel, wrappedChannel); // Unref and ref channel after destroy delay; expect a new raw channel. @@ -77,19 +77,19 @@ static NSString *kDummyPath = @"/dummy/path"; } sleep(kDestroyDelay + 1); XCTAssertNil(channel.wrappedChannel); - wrappedCall = [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options]; + wrappedCall = [channel wrappedCallWithPath:kPhonyPath completionQueue:cq callOptions:options]; XCTAssertNotEqual(channel.wrappedChannel, wrappedChannel); } - (void)testDisconnect { const NSTimeInterval kDestroyDelay = 1.0; GRPCCallOptions *options = [[GRPCCallOptions alloc] init]; - GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost + GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kPhonyHost callOptions:options]; GRPCPooledChannel *channel = [[GRPCPooledChannel alloc] initWithChannelConfiguration:config destroyDelay:kDestroyDelay]; GRPCCompletionQueue *cq = [GRPCCompletionQueue completionQueue]; - GRPCWrappedCall *wrappedCall = [channel wrappedCallWithPath:kDummyPath + GRPCWrappedCall *wrappedCall = [channel wrappedCallWithPath:kPhonyPath completionQueue:cq callOptions:options]; XCTAssertNotNil(channel.wrappedChannel); @@ -100,7 +100,7 @@ static NSString *kDummyPath = @"/dummy/path"; // Create a new call and unref the old call; confirm that destroy of the old call does not make // the channel disconnect, even after the destroy delay. - GRPCWrappedCall *wrappedCall2 = [channel wrappedCallWithPath:kDummyPath + GRPCWrappedCall *wrappedCall2 = [channel wrappedCallWithPath:kPhonyPath completionQueue:cq callOptions:options]; XCTAssertNotNil(channel.wrappedChannel); diff --git a/src/objective-c/tests/UnitTests/GRPCClientTests.m b/src/objective-c/tests/UnitTests/GRPCClientTests.m index 85d6ba1d2dd..25cf0e846f7 100644 --- a/src/objective-c/tests/UnitTests/GRPCClientTests.m +++ b/src/objective-c/tests/UnitTests/GRPCClientTests.m @@ -532,11 +532,11 @@ static GRPCProtoMethod *kFullDuplexCallMethod; - (void)testErrorCode { int port = [self findFreePort]; - NSString *const kDummyAddress = [NSString stringWithFormat:@"localhost:%d", port]; + NSString *const kPhonyAddress = [NSString stringWithFormat:@"localhost:%d", port]; __weak XCTestExpectation *completion = [self expectationWithDescription:@"Received correct error code."]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:kDummyAddress + GRPCCall *call = [[GRPCCall alloc] initWithHost:kPhonyAddress path:kEmptyCallMethod.HTTPPath requestsWriter:[GRXWriter writerWithValue:[NSData data]]]; @@ -561,14 +561,14 @@ static GRPCProtoMethod *kFullDuplexCallMethod; const double kMargin = 0.1; __weak XCTestExpectation *completion = [self expectationWithDescription:@"Timeout in a second."]; - NSString *const kDummyAddress = [NSString stringWithFormat:@"8.8.8.8:1"]; - [GRPCCall useInsecureConnectionsForHost:kDummyAddress]; + NSString *const kPhonyAddress = [NSString stringWithFormat:@"8.8.8.8:1"]; + [GRPCCall useInsecureConnectionsForHost:kPhonyAddress]; [GRPCCall setMinConnectTimeout:timeout * 1000 initialBackoff:backoff * 1000 maxBackoff:0 - forHost:kDummyAddress]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:kDummyAddress - path:@"/dummyPath" + forHost:kPhonyAddress]; + GRPCCall *call = [[GRPCCall alloc] initWithHost:kPhonyAddress + path:@"/phonyPath" requestsWriter:[GRXWriter writerWithValue:[NSData data]]]; NSDate *startTime = [NSDate date]; id responsesWriteable = [[GRXWriteable alloc] diff --git a/src/objective-c/tests/UnitTests/TransportTests.m b/src/objective-c/tests/UnitTests/TransportTests.m index 4d8f301a1bb..0eb09517311 100644 --- a/src/objective-c/tests/UnitTests/TransportTests.m +++ b/src/objective-c/tests/UnitTests/TransportTests.m @@ -68,13 +68,13 @@ static GRPCFakeTransportFactory *fakeTransportFactory; @end -@interface DummyInterceptor : GRPCInterceptor +@interface PhonyInterceptor : GRPCInterceptor @property(atomic) BOOL hit; @end -@implementation DummyInterceptor { +@implementation PhonyInterceptor { GRPCInterceptorManager *_manager; BOOL _passthrough; } @@ -114,15 +114,15 @@ static GRPCFakeTransportFactory *fakeTransportFactory; @end -@interface DummyInterceptorFactory : NSObject +@interface PhonyInterceptorFactory : NSObject - (instancetype)initWithPassthrough:(BOOL)passthrough; -@property(nonatomic, readonly) DummyInterceptor *lastInterceptor; +@property(nonatomic, readonly) PhonyInterceptor *lastInterceptor; @end -@implementation DummyInterceptorFactory { +@implementation PhonyInterceptorFactory { BOOL _passthrough; } @@ -134,7 +134,7 @@ static GRPCFakeTransportFactory *fakeTransportFactory; } - (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { - _lastInterceptor = [[DummyInterceptor alloc] + _lastInterceptor = [[PhonyInterceptor alloc] initWithInterceptorManager:interceptorManager dispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL) passthrough:_passthrough]; @@ -214,8 +214,8 @@ static GRPCFakeTransportFactory *fakeTransportFactory; [self expectationWithDescription:@"Expect call complete"]; [GRPCFakeTransportFactory sharedInstance].nextTransportInstance = nil; - DummyInterceptorFactory *factory = [[DummyInterceptorFactory alloc] initWithPassthrough:YES]; - DummyInterceptorFactory *factory2 = [[DummyInterceptorFactory alloc] initWithPassthrough:NO]; + PhonyInterceptorFactory *factory = [[PhonyInterceptorFactory alloc] initWithPassthrough:YES]; + PhonyInterceptorFactory *factory2 = [[PhonyInterceptorFactory alloc] initWithPassthrough:NO]; [[GRPCFakeTransportFactory sharedInstance] setTransportInterceptorFactories:@[ factory, factory2 ]]; GRPCRequestOptions *requestOptions = diff --git a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php index f1d7e6f6ec0..a80b9bb6f6c 100644 --- a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php +++ b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php @@ -162,7 +162,7 @@ abstract class AbstractGeneratedCodeTest extends \PHPUnit\Framework\TestCase public function testInvalidMethodName() { $this->expectException(\InvalidArgumentException::class); - $invalid_client = new DummyInvalidClient('host', [ + $invalid_client = new PhonyInvalidClient('host', [ 'credentials' => Grpc\ChannelCredentials::createInsecure(), ]); $div_arg = new Math\DivArgs(); @@ -173,13 +173,13 @@ abstract class AbstractGeneratedCodeTest extends \PHPUnit\Framework\TestCase { $this->expectException(\Exception::class); $this->expectExceptionMessage("The opts['credentials'] key is now required."); - $invalid_client = new DummyInvalidClient('host', [ + $invalid_client = new PhonyInvalidClient('host', [ ]); } public function testPrimaryUserAgentString() { - $invalid_client = new DummyInvalidClient('host', [ + $invalid_client = new PhonyInvalidClient('host', [ 'credentials' => Grpc\ChannelCredentials::createInsecure(), 'grpc.primary_user_agent' => 'testUserAgent', ]); @@ -310,7 +310,7 @@ abstract class AbstractGeneratedCodeTest extends \PHPUnit\Framework\TestCase } } -class DummyInvalidClient extends \Grpc\BaseStub +class PhonyInvalidClient extends \Grpc\BaseStub { public function InvalidUnaryCall(\Math\DivArgs $argument, $metadata = [], diff --git a/src/php/tests/unit_tests/CallCredentials2Test.php b/src/php/tests/unit_tests/CallCredentials2Test.php index 35cf821645c..ee1c7585180 100644 --- a/src/php/tests/unit_tests/CallCredentials2Test.php +++ b/src/php/tests/unit_tests/CallCredentials2Test.php @@ -62,7 +62,7 @@ class CallCredentials2Test extends \PHPUnit\Framework\TestCase $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - '/abc/dummy_method', + '/abc/phony_method', $deadline, $this->host_override); @@ -87,7 +87,7 @@ class CallCredentials2Test extends \PHPUnit\Framework\TestCase $this->assertSame($metadata['k1'], ['v1']); $this->assertSame($metadata['k2'], ['v2']); - $this->assertSame('/abc/dummy_method', $event->method); + $this->assertSame('/abc/phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -132,7 +132,7 @@ class CallCredentials2Test extends \PHPUnit\Framework\TestCase $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - '/abc/dummy_method', + '/abc/phony_method', $deadline, $this->host_override); @@ -164,7 +164,7 @@ class CallCredentials2Test extends \PHPUnit\Framework\TestCase $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - '/abc/dummy_method', + '/abc/phony_method', $deadline, $this->host_override); diff --git a/src/php/tests/unit_tests/CallCredentialsTest.php b/src/php/tests/unit_tests/CallCredentialsTest.php index 42bf480d3b8..3929c47852b 100644 --- a/src/php/tests/unit_tests/CallCredentialsTest.php +++ b/src/php/tests/unit_tests/CallCredentialsTest.php @@ -68,7 +68,7 @@ class CallCredentialsTest extends \PHPUnit\Framework\TestCase $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - '/abc/dummy_method', + '/abc/phony_method', $deadline, $this->host_override); @@ -89,7 +89,7 @@ class CallCredentialsTest extends \PHPUnit\Framework\TestCase $this->assertSame($metadata['k1'], ['v1']); $this->assertSame($metadata['k2'], ['v2']); - $this->assertSame('/abc/dummy_method', $event->method); + $this->assertSame('/abc/phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ diff --git a/src/php/tests/unit_tests/CallInvokerTest.php b/src/php/tests/unit_tests/CallInvokerTest.php index 4663695298b..f44226aad28 100644 --- a/src/php/tests/unit_tests/CallInvokerTest.php +++ b/src/php/tests/unit_tests/CallInvokerTest.php @@ -70,7 +70,7 @@ class CallInvokerClient extends Grpc\BaseStub $options = [] ) { return $this->_simpleRequest( - '/dummy_method', + '/phony_method', $argument, [], $metadata, @@ -209,7 +209,7 @@ class CallInvokerTest extends \PHPUnit\Framework\TestCase $unary_call = $client->UnaryCall($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index 700da87f654..52184d8fc6a 100644 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -39,7 +39,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -51,7 +51,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_close); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -88,7 +88,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $req_text = 'message_write_flags_test'; $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -102,7 +102,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_close); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -136,7 +136,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -150,7 +150,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_message); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -197,7 +197,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -216,7 +216,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -235,7 +235,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -256,7 +256,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -270,7 +270,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_message); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -295,7 +295,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -309,7 +309,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_message); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -334,7 +334,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -348,7 +348,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_message); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -372,7 +372,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -386,7 +386,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_message); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -411,7 +411,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -425,7 +425,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_message); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -449,7 +449,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ @@ -466,7 +466,7 @@ class EndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline); $event = $call->startBatch([ diff --git a/src/php/tests/unit_tests/InterceptorTest.php b/src/php/tests/unit_tests/InterceptorTest.php index 9ca26752edd..860000d83db 100644 --- a/src/php/tests/unit_tests/InterceptorTest.php +++ b/src/php/tests/unit_tests/InterceptorTest.php @@ -69,7 +69,7 @@ class InterceptorClient extends Grpc\BaseStub $options = [] ) { return $this->_simpleRequest( - '/dummy_method', + '/phony_method', $argument, [], $metadata, @@ -86,7 +86,7 @@ class InterceptorClient extends Grpc\BaseStub $metadata = [], $options = [] ) { - return $this->_clientStreamRequest('/dummy_method', [], $metadata, $options); + return $this->_clientStreamRequest('/phony_method', [], $metadata, $options); } } @@ -246,13 +246,13 @@ class InterceptorTest extends \PHPUnit\Framework\TestCase $req = new SimpleRequest($req_text); $unary_call = $client->UnaryCall($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $this->assertSame(['interceptor_from_unary_request'], $event->metadata['foo']); $stream_call = $client->StreamCall(); $stream_call->write($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $this->assertSame(['interceptor_from_stream_request'], $event->metadata['foo']); unset($unary_call); @@ -276,14 +276,14 @@ class InterceptorTest extends \PHPUnit\Framework\TestCase $req = new SimpleRequest($req_text); $unary_call = $client->UnaryCall($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $this->assertSame(['interceptor_from_unary_request'], $event->metadata['foo']); $this->assertSame(['interceptor_from_unary_request'], $event->metadata['bar']); $stream_call = $client->StreamCall(); $stream_call->write($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $this->assertSame(['interceptor_from_stream_request'], $event->metadata['foo']); $this->assertSame(['interceptor_from_stream_request'], $event->metadata['bar']); @@ -302,14 +302,14 @@ class InterceptorTest extends \PHPUnit\Framework\TestCase $req = new SimpleRequest($req_text); $unary_call = $client->UnaryCall($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $this->assertSame(['interceptor_from_unary_request'], $event->metadata['foo']); $this->assertSame(['interceptor_from_unary_request'], $event->metadata['bar']); $stream_call = $client->StreamCall(); $stream_call->write($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $this->assertSame(['interceptor_from_stream_request'], $event->metadata['foo']); $this->assertSame(['interceptor_from_stream_request'], $event->metadata['bar']); @@ -333,7 +333,7 @@ class InterceptorTest extends \PHPUnit\Framework\TestCase $unary_call = $client->UnaryCall($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], @@ -350,7 +350,7 @@ class InterceptorTest extends \PHPUnit\Framework\TestCase $stream_call = $client->StreamCall(); $stream_call->write($req); $event = $this->server->requestCall(); - $this->assertSame('/dummy_method', $event->method); + $this->assertSame('/phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ Grpc\OP_SEND_INITIAL_METADATA => [], diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index da9d9d07fac..5d4f71023a8 100644 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -53,7 +53,7 @@ class SecureEndToEndTest extends \PHPUnit\Framework\TestCase $deadline = Grpc\Timeval::infFuture(); $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline, $this->host_override); @@ -66,7 +66,7 @@ class SecureEndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_close); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -104,7 +104,7 @@ class SecureEndToEndTest extends \PHPUnit\Framework\TestCase $req_text = 'message_write_flags_test'; $status_text = 'xyz'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline, $this->host_override); @@ -119,7 +119,7 @@ class SecureEndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_close); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ @@ -154,7 +154,7 @@ class SecureEndToEndTest extends \PHPUnit\Framework\TestCase $status_text = 'status:client_server_full_response_text'; $call = new Grpc\Call($this->channel, - 'dummy_method', + 'phony_method', $deadline, $this->host_override); @@ -169,7 +169,7 @@ class SecureEndToEndTest extends \PHPUnit\Framework\TestCase $this->assertTrue($event->send_message); $event = $this->server->requestCall(); - $this->assertSame('dummy_method', $event->method); + $this->assertSame('phony_method', $event->method); $server_call = $event->call; $event = $server_call->startBatch([ diff --git a/src/php/tests/unit_tests/ServerTest.php b/src/php/tests/unit_tests/ServerTest.php index d0d6d25d39d..c85116a904d 100644 --- a/src/php/tests/unit_tests/ServerTest.php +++ b/src/php/tests/unit_tests/ServerTest.php @@ -61,7 +61,7 @@ class ServerTest extends \PHPUnit\Framework\TestCase ]); $deadline = Grpc\Timeval::infFuture(); - $call = new Grpc\Call($channel, 'dummy_method', $deadline); + $call = new Grpc\Call($channel, 'phony_method', $deadline); $event = $call->startBatch([Grpc\OP_SEND_INITIAL_METADATA => [], Grpc\OP_SEND_CLOSE_FROM_CLIENT => true, @@ -70,7 +70,7 @@ class ServerTest extends \PHPUnit\Framework\TestCase $c = $this->server->requestCall(); $this->assertObjectHasAttribute('call', $c); $this->assertObjectHasAttribute('method', $c); - $this->assertSame('dummy_method', $c->method); + $this->assertSame('phony_method', $c->method); $this->assertObjectHasAttribute('host', $c); $this->assertTrue(is_string($c->host)); $this->assertObjectHasAttribute('absolute_deadline', $c); diff --git a/src/proto/grpc/testing/xds/v3/ads.proto b/src/proto/grpc/testing/xds/v3/ads.proto index aea815d0006..d576c1ddc57 100644 --- a/src/proto/grpc/testing/xds/v3/ads.proto +++ b/src/proto/grpc/testing/xds/v3/ads.proto @@ -41,5 +41,5 @@ service AggregatedDiscoveryService { // [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing // services: https://github.com/google/protobuf/issues/4221 -message AdsDummy { +message AdsPhony { } diff --git a/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py b/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py index e2b36b1c70f..0dafc9e9825 100644 --- a/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py +++ b/src/python/grpcio_tests/tests/unit/_metadata_flags_test.py @@ -100,8 +100,8 @@ class _GenericHandler(grpc.GenericRpcHandler): return None -def create_dummy_channel(): - """Creating dummy channels is a workaround for retries""" +def create_phony_channel(): + """Creating phony channels is a workaround for retries""" host, port, sock = get_socket(sock_options=(socket.SO_REUSEADDR,)) sock.close() return grpc.insecure_channel('{}:{}'.format(host, port)) @@ -188,12 +188,12 @@ class MetadataFlagsTest(unittest.TestCase): def test_call_wait_for_ready_default(self): for perform_call in _ALL_CALL_CASES: - with create_dummy_channel() as channel: + with create_phony_channel() as channel: self.check_connection_does_failfast(perform_call, channel) def test_call_wait_for_ready_disabled(self): for perform_call in _ALL_CALL_CASES: - with create_dummy_channel() as channel: + with create_phony_channel() as channel: self.check_connection_does_failfast(perform_call, channel, wait_for_ready=False) diff --git a/src/python/grpcio_tests/tests_aio/unit/abort_test.py b/src/python/grpcio_tests/tests_aio/unit/abort_test.py index 828b6884dfa..487c8c972e1 100644 --- a/src/python/grpcio_tests/tests_aio/unit/abort_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/abort_test.py @@ -33,7 +33,7 @@ _RESPONSE = b'\x01\x01\x01' _NUM_STREAM_RESPONSES = 5 _ABORT_CODE = grpc.StatusCode.RESOURCE_EXHAUSTED -_ABORT_DETAILS = 'Dummy error details' +_ABORT_DETAILS = 'Phony error details' class _GenericHandler(grpc.GenericRpcHandler): diff --git a/src/python/grpcio_tests/tests_aio/unit/init_test.py b/src/python/grpcio_tests/tests_aio/unit/init_test.py index b9183a22c75..b7889b9942b 100644 --- a/src/python/grpcio_tests/tests_aio/unit/init_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/init_test.py @@ -19,12 +19,12 @@ class TestInit(unittest.TestCase): def test_grpc(self): import grpc # pylint: disable=wrong-import-position - channel = grpc.aio.insecure_channel('dummy') + channel = grpc.aio.insecure_channel('phony') self.assertIsInstance(channel, grpc.aio.Channel) def test_grpc_dot_aio(self): import grpc.aio # pylint: disable=wrong-import-position - channel = grpc.aio.insecure_channel('dummy') + channel = grpc.aio.insecure_channel('phony') self.assertIsInstance(channel, grpc.aio.Channel) diff --git a/src/python/grpcio_tests/tests_aio/unit/wait_for_connection_test.py b/src/python/grpcio_tests/tests_aio/unit/wait_for_connection_test.py index cb6f7985290..4fbe074740e 100644 --- a/src/python/grpcio_tests/tests_aio/unit/wait_for_connection_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/wait_for_connection_test.py @@ -42,11 +42,11 @@ class TestWaitForConnection(AioTestBase): async def setUp(self): address, self._server = await start_test_server() self._channel = aio.insecure_channel(address) - self._dummy_channel = aio.insecure_channel(UNREACHABLE_TARGET) + self._phony_channel = aio.insecure_channel(UNREACHABLE_TARGET) self._stub = test_pb2_grpc.TestServiceStub(self._channel) async def tearDown(self): - await self._dummy_channel.close() + await self._phony_channel.close() await self._channel.close() await self._server.stop(None) @@ -122,7 +122,7 @@ class TestWaitForConnection(AioTestBase): self.assertEqual(grpc.StatusCode.OK, await call.code()) async def test_unary_unary_error(self): - call = self._dummy_channel.unary_unary(_TEST_METHOD)(_REQUEST) + call = self._phony_channel.unary_unary(_TEST_METHOD)(_REQUEST) with self.assertRaises(aio.AioRpcError) as exception_context: await call.wait_for_connection() @@ -130,7 +130,7 @@ class TestWaitForConnection(AioTestBase): self.assertEqual(grpc.StatusCode.UNAVAILABLE, rpc_error.code()) async def test_unary_stream_error(self): - call = self._dummy_channel.unary_stream(_TEST_METHOD)(_REQUEST) + call = self._phony_channel.unary_stream(_TEST_METHOD)(_REQUEST) with self.assertRaises(aio.AioRpcError) as exception_context: await call.wait_for_connection() @@ -138,7 +138,7 @@ class TestWaitForConnection(AioTestBase): self.assertEqual(grpc.StatusCode.UNAVAILABLE, rpc_error.code()) async def test_stream_unary_error(self): - call = self._dummy_channel.stream_unary(_TEST_METHOD)() + call = self._phony_channel.stream_unary(_TEST_METHOD)() with self.assertRaises(aio.AioRpcError) as exception_context: await call.wait_for_connection() @@ -146,7 +146,7 @@ class TestWaitForConnection(AioTestBase): self.assertEqual(grpc.StatusCode.UNAVAILABLE, rpc_error.code()) async def test_stream_stream_error(self): - call = self._dummy_channel.stream_stream(_TEST_METHOD)() + call = self._phony_channel.stream_stream(_TEST_METHOD)() with self.assertRaises(aio.AioRpcError) as exception_context: await call.wait_for_connection() diff --git a/src/ruby/end2end/grpc_class_init_client.rb b/src/ruby/end2end/grpc_class_init_client.rb index ff40350cfae..c4a54374b65 100755 --- a/src/ruby/end2end/grpc_class_init_client.rb +++ b/src/ruby/end2end/grpc_class_init_client.rb @@ -70,7 +70,7 @@ def get_test_proc(grpc_class) case grpc_class when 'channel' return proc do - GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) + GRPC::Core::Channel.new('phony_host', nil, :this_channel_is_insecure) end when 'server' return proc do diff --git a/src/ruby/end2end/load_grpc_with_gc_stress_test.rb b/src/ruby/end2end/load_grpc_with_gc_stress_test.rb index 3668b95a052..9b0ca765f86 100755 --- a/src/ruby/end2end/load_grpc_with_gc_stress_test.rb +++ b/src/ruby/end2end/load_grpc_with_gc_stress_test.rb @@ -25,7 +25,7 @@ GC.stress = 0x04 require 'grpc' -GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) +GRPC::Core::Channel.new('phony_host', nil, :this_channel_is_insecure) GRPC::Core::Server.new({}) GRPC::Core::ChannelCredentials.new GRPC::Core::CallCredentials.new(proc { |noop| noop }) diff --git a/src/ruby/end2end/multiple_killed_watching_threads_test.rb b/src/ruby/end2end/multiple_killed_watching_threads_test.rb index 7b39f5a3476..dffb3db9ab4 100755 --- a/src/ruby/end2end/multiple_killed_watching_threads_test.rb +++ b/src/ruby/end2end/multiple_killed_watching_threads_test.rb @@ -35,7 +35,7 @@ end def run_multiple_killed_watches(num_threads, sleep_time) channels = [] num_threads.times do - ch = GRPC::Core::Channel.new('dummy_host', + ch = GRPC::Core::Channel.new('phony_host', nil, :this_channel_is_insecure) watch_state(ch, sleep_time) channels << ch diff --git a/src/ruby/ext/grpc/rb_compression_options.c b/src/ruby/ext/grpc/rb_compression_options.c index d10c603460c..53b71e2a19b 100644 --- a/src/ruby/ext/grpc/rb_compression_options.c +++ b/src/ruby/ext/grpc/rb_compression_options.c @@ -142,7 +142,7 @@ grpc_compression_level grpc_rb_compression_options_level_name_to_value_internal( "Unrecognized compression level name." "Valid compression level names are none, low, medium, and high."); - /* Dummy return statement. */ + /* Phony return statement. */ return GRPC_COMPRESS_LEVEL_NONE; } diff --git a/src/ruby/ext/grpc/rb_enable_cpp.cc b/src/ruby/ext/grpc/rb_enable_cpp.cc index f44e4f515a7..701b2cf8f27 100644 --- a/src/ruby/ext/grpc/rb_enable_cpp.cc +++ b/src/ruby/ext/grpc/rb_enable_cpp.cc @@ -18,5 +18,5 @@ #include -// This is a dummy C++ source file to trigger ruby extension builder to +// This is a phony C++ source file to trigger ruby extension builder to // pick C++ rather than C linker to link with c++ library properly. diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb index 22d345f658d..c4296bb5ada 100644 --- a/src/ruby/spec/call_spec.rb +++ b/src/ruby/spec/call_spec.rb @@ -171,7 +171,7 @@ describe GRPC::Core::Call do end def make_test_call - @ch.create_call(nil, nil, 'dummy_method', nil, deadline) + @ch.create_call(nil, nil, 'phony_method', nil, deadline) end def deadline diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb index adba6db99cf..a4d2d4b427a 100644 --- a/src/ruby/spec/channel_spec.rb +++ b/src/ruby/spec/channel_spec.rb @@ -53,7 +53,7 @@ describe GRPC::Core::Channel do shared_examples '#new' do it 'take a host name without channel args' do blk = proc do - GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) + GRPC::Core::Channel.new('phony_host', nil, :this_channel_is_insecure) end expect(&blk).not_to raise_error end @@ -114,7 +114,7 @@ describe GRPC::Core::Channel do describe '#new for secure channels' do def construct_with_args(a) - proc { GRPC::Core::Channel.new('dummy_host', a, create_test_cert) } + proc { GRPC::Core::Channel.new('phony_host', a, create_test_cert) } end it_behaves_like '#new' @@ -125,7 +125,7 @@ describe GRPC::Core::Channel do def construct_with_args(a) proc do - GRPC::Core::Channel.new('dummy_host', a, :this_channel_is_insecure) + GRPC::Core::Channel.new('phony_host', a, :this_channel_is_insecure) end end end @@ -137,7 +137,7 @@ describe GRPC::Core::Channel do deadline = Time.now + 5 blk = proc do - ch.create_call(nil, nil, 'dummy_method', nil, deadline) + ch.create_call(nil, nil, 'phony_method', nil, deadline) end expect(&blk).to_not raise_error end @@ -148,7 +148,7 @@ describe GRPC::Core::Channel do deadline = Time.now + 5 blk = proc do - ch.create_call(nil, nil, 'dummy_method', nil, deadline) + ch.create_call(nil, nil, 'phony_method', nil, deadline) end expect(&blk).to raise_error(RuntimeError) end @@ -160,7 +160,7 @@ describe GRPC::Core::Channel do blk = proc do fork_with_propagated_error_message do - ch.create_call(nil, nil, 'dummy_method', nil, deadline) + ch.create_call(nil, nil, 'phony_method', nil, deadline) end end expect(&blk).to raise_error(RuntimeError, 'grpc cannot be used before and after forking') diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb index 34b58593d37..4f9ce168035 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -198,11 +198,11 @@ describe GRPC::ActiveCall do deadline, started: false) - metadata = { key: 'dummy_val', other: 'other_val' } + metadata = { key: 'phony_val', other: 'other_val' } expect(@client_call.metadata_sent).to eq(false) @client_call.merge_metadata_to_send(metadata) - message = 'dummy message' + message = 'phony message' expect(call).to( receive(:run_batch) diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc index 455d6ae3634..a222242d3eb 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.cc +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -123,7 +123,7 @@ int main(int argc, char** argv) { static int check_stack(const char* file, int line, const char* transport_name, grpc_channel_args* init_args, unsigned channel_stack_type, ...) { - // create dummy channel stack + // create phony channel stack grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create(); grpc_transport_vtable fake_transport_vtable; memset(&fake_transport_vtable, 0, sizeof(grpc_transport_vtable)); diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc index 08bc8d5a9a8..f79031dd55a 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc @@ -77,10 +77,10 @@ static grpc_ares_request* my_dns_lookup_ares_locked( } else { gpr_mu_unlock(&g_mu); *addresses = absl::make_unique(); - grpc_resolved_address dummy_resolved_address; - memset(&dummy_resolved_address, 0, sizeof(dummy_resolved_address)); - dummy_resolved_address.len = 123; - (*addresses)->emplace_back(dummy_resolved_address, nullptr); + grpc_resolved_address phony_resolved_address; + memset(&phony_resolved_address, 0, sizeof(phony_resolved_address)); + phony_resolved_address.len = 123; + (*addresses)->emplace_back(phony_resolved_address, nullptr); } grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_done, error); return nullptr; diff --git a/test/core/end2end/fixtures/inproc.cc b/test/core/end2end/fixtures/inproc.cc index 05534eeb6e5..2bd25c0b646 100644 --- a/test/core/end2end/fixtures/inproc.cc +++ b/test/core/end2end/fixtures/inproc.cc @@ -34,7 +34,7 @@ #include "test/core/util/test_config.h" typedef struct inproc_fixture_data { - bool dummy; // reserved for future expansion. Struct can't be empty + bool phony; // reserved for future expansion. Struct can't be empty } inproc_fixture_data; static grpc_end2end_test_fixture inproc_create_fixture( diff --git a/test/core/end2end/inproc_callback_test.cc b/test/core/end2end/inproc_callback_test.cc index 8605a6a409b..caf4e3794d6 100644 --- a/test/core/end2end/inproc_callback_test.cc +++ b/test/core/end2end/inproc_callback_test.cc @@ -32,7 +32,7 @@ #include "test/core/util/test_config.h" typedef struct inproc_fixture_data { - bool dummy; // reserved for future expansion. Struct can't be empty + bool phony; // reserved for future expansion. Struct can't be empty } inproc_fixture_data; namespace { diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc index e0b29abb454..85f5378f7f4 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -81,7 +81,7 @@ static void create_test_socket(int port, int* socket_fd, sin->sin_port = htons(static_cast(port)); } -/* Dummy gRPC callback */ +/* Phony gRPC callback */ void no_op_cb(void* /*arg*/, int /*success*/) {} /* =======An upload server to test notify_on_read=========== diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm b/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm index 414b6c78c0b..24afdd28e03 100644 --- a/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm @@ -90,7 +90,7 @@ static void must_fail(void* arg, grpc_error* error) { resolved_addr.len = sizeof(struct sockaddr_in); addr->sin_family = AF_INET; - /* create a dummy server */ + /* create a phony server */ svr_fd = socket(AF_INET, SOCK_STREAM, 0); GPR_ASSERT(svr_fd >= 0); GPR_ASSERT(0 == bind(svr_fd, (struct sockaddr*)addr, (socklen_t)resolved_addr.len)); @@ -181,7 +181,7 @@ static void must_fail(void* arg, grpc_error* error) { #else // GRPC_CFSTREAM -// Dummy test suite +// Phony test suite @interface CFStreamClientTests : XCTestCase @end diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm b/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm index c882479a8d5..5cd0d693102 100644 --- a/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm @@ -116,7 +116,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch resolved_addr.len = sizeof(struct sockaddr_in); addr->sin_family = AF_INET; - /* create a dummy server */ + /* create a phony server */ svr_fd = socket(AF_INET, SOCK_STREAM, 0); XCTAssertGreaterThanOrEqual(svr_fd, 0); XCTAssertEqual(bind(svr_fd, (struct sockaddr *)addr, (socklen_t)resolved_addr.len), 0); @@ -326,7 +326,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch #else // GRPC_CFSTREAM -// Dummy test suite +// Phony test suite @interface CFStreamEndpointTests : XCTestCase @end diff --git a/test/core/iomgr/sockaddr_utils_test.cc b/test/core/iomgr/sockaddr_utils_test.cc index b21f9dc7455..6464933477f 100644 --- a/test/core/iomgr/sockaddr_utils_test.cc +++ b/test/core/iomgr/sockaddr_utils_test.cc @@ -130,7 +130,7 @@ static void test_sockaddr_is_wildcard(void) { grpc_resolved_address wild4; grpc_resolved_address wild6; grpc_resolved_address wild_mapped; - grpc_resolved_address dummy; + grpc_resolved_address phony; grpc_sockaddr_in* wild4_addr; grpc_sockaddr_in6* wild6_addr; grpc_sockaddr_in6* wild_mapped_addr; @@ -168,8 +168,8 @@ static void test_sockaddr_is_wildcard(void) { /* Test AF_UNSPEC. */ port = -1; - memset(&dummy, 0, sizeof(dummy)); - GPR_ASSERT(!grpc_sockaddr_is_wildcard(&dummy, &port)); + memset(&phony, 0, sizeof(phony)); + GPR_ASSERT(!grpc_sockaddr_is_wildcard(&phony, &port)); GPR_ASSERT(port == -1); } @@ -190,8 +190,8 @@ static void expect_sockaddr_uri(const char* expected, static void test_sockaddr_to_string(void) { grpc_resolved_address input4; grpc_resolved_address input6; - grpc_resolved_address dummy; - grpc_sockaddr* dummy_addr; + grpc_resolved_address phony; + grpc_sockaddr* phony_addr; gpr_log(GPR_INFO, "%s", "test_sockaddr_to_string"); @@ -227,19 +227,19 @@ static void test_sockaddr_to_string(void) { expect_sockaddr_str("[::fffe:c000:263]:12345", &input6, 1); expect_sockaddr_uri("ipv6:[::fffe:c000:263]:12345", &input6); - memset(&dummy, 0, sizeof(dummy)); - dummy_addr = reinterpret_cast(dummy.addr); - dummy_addr->sa_family = 123; - expect_sockaddr_str("(sockaddr family=123)", &dummy, 0); - expect_sockaddr_str("(sockaddr family=123)", &dummy, 1); - GPR_ASSERT(grpc_sockaddr_to_uri(&dummy).empty()); + memset(&phony, 0, sizeof(phony)); + phony_addr = reinterpret_cast(phony.addr); + phony_addr->sa_family = 123; + expect_sockaddr_str("(sockaddr family=123)", &phony, 0); + expect_sockaddr_str("(sockaddr family=123)", &phony, 1); + GPR_ASSERT(grpc_sockaddr_to_uri(&phony).empty()); } static void test_sockaddr_set_get_port(void) { grpc_resolved_address input4; grpc_resolved_address input6; - grpc_resolved_address dummy; - grpc_sockaddr* dummy_addr; + grpc_resolved_address phony; + grpc_sockaddr* phony_addr; gpr_log(GPR_DEBUG, "test_sockaddr_set_get_port"); @@ -253,11 +253,11 @@ static void test_sockaddr_set_get_port(void) { GPR_ASSERT(grpc_sockaddr_set_port(&input6, 54321)); GPR_ASSERT(grpc_sockaddr_get_port(&input6) == 54321); - memset(&dummy, 0, sizeof(dummy)); - dummy_addr = reinterpret_cast(dummy.addr); - dummy_addr->sa_family = 123; - GPR_ASSERT(grpc_sockaddr_get_port(&dummy) == 0); - GPR_ASSERT(grpc_sockaddr_set_port(&dummy, 1234) == 0); + memset(&phony, 0, sizeof(phony)); + phony_addr = reinterpret_cast(phony.addr); + phony_addr->sa_family = 123; + GPR_ASSERT(grpc_sockaddr_get_port(&phony) == 0); + GPR_ASSERT(grpc_sockaddr_set_port(&phony, 1234) == 0); } int main(int argc, char** argv) { diff --git a/test/core/iomgr/tcp_client_posix_test.cc b/test/core/iomgr/tcp_client_posix_test.cc index 50293765c3f..d9186094c59 100644 --- a/test/core/iomgr/tcp_client_posix_test.cc +++ b/test/core/iomgr/tcp_client_posix_test.cc @@ -92,7 +92,7 @@ void test_succeeds(void) { resolved_addr.len = static_cast(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; - /* create a dummy server */ + /* create a phony server */ svr_fd = socket(AF_INET, SOCK_STREAM, 0); GPR_ASSERT(svr_fd >= 0); GPR_ASSERT( diff --git a/test/core/iomgr/tcp_client_uv_test.cc b/test/core/iomgr/tcp_client_uv_test.cc index 90a1a432771..35e8d180f4c 100644 --- a/test/core/iomgr/tcp_client_uv_test.cc +++ b/test/core/iomgr/tcp_client_uv_test.cc @@ -95,7 +95,7 @@ void test_succeeds(void) { resolved_addr.len = sizeof(struct sockaddr_in); addr->sin_family = AF_INET; - /* create a dummy server */ + /* create a phony server */ GPR_ASSERT(0 == uv_tcp_init(uv_default_loop(), svr_handle)); GPR_ASSERT(0 == uv_tcp_bind(svr_handle, (struct sockaddr*)addr, 0)); GPR_ASSERT(0 == uv_listen((uv_stream_t*)svr_handle, 1, connection_cb)); diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 604ab358682..8bed1a05f31 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -1663,19 +1663,19 @@ struct fake_call_creds : public grpc_call_credentials { explicit fake_call_creds() : grpc_call_credentials("fake") { grpc_slice key = grpc_slice_from_static_string("foo"); grpc_slice value = grpc_slice_from_static_string("oof"); - dummy_md_ = grpc_mdelem_from_slices(key, value); + phony_md_ = grpc_mdelem_from_slices(key, value); grpc_slice_unref(key); grpc_slice_unref(value); } - ~fake_call_creds() override { GRPC_MDELEM_UNREF(dummy_md_); } + ~fake_call_creds() override { GRPC_MDELEM_UNREF(phony_md_); } bool get_request_metadata(grpc_polling_entity* /*pollent*/, grpc_auth_metadata_context /*context*/, grpc_credentials_mdelem_array* md_array, grpc_closure* /*on_request_metadata*/, grpc_error** /*error*/) override { - grpc_credentials_mdelem_array_add(md_array, dummy_md_); + grpc_credentials_mdelem_array_add(md_array, phony_md_); return true; } @@ -1683,7 +1683,7 @@ struct fake_call_creds : public grpc_call_credentials { grpc_error* /*error*/) override {} private: - grpc_mdelem dummy_md_; + grpc_mdelem phony_md_; }; static void test_google_default_creds_not_default(void) { diff --git a/test/core/security/etc/README b/test/core/security/etc/README index 6ba43825861..a7432bb0ccf 100644 --- a/test/core/security/etc/README +++ b/test/core/security/etc/README @@ -1,2 +1,2 @@ These files are manual copies of a pem cert from the /etc/ssl/certs/ directory. -They serve only as dummy certificate test files. +They serve only as phony certificate test files. diff --git a/test/core/transport/chttp2/context_list_test.cc b/test/core/transport/chttp2/context_list_test.cc index 9305fb20cd9..9f0ffeb54e6 100644 --- a/test/core/transport/chttp2/context_list_test.cc +++ b/test/core/transport/chttp2/context_list_test.cc @@ -36,7 +36,7 @@ namespace { const uint32_t kByteOffset = 123; -void* DummyArgsCopier(void* arg) { return arg; } +void* PhonyArgsCopier(void* arg) { return arg; } void TestExecuteFlushesListVerifier(void* arg, grpc_core::Timestamps* ts, grpc_error* error) { @@ -55,7 +55,7 @@ class ContextListTest : public ::testing::Test { protected: void SetUp() override { grpc_http2_set_write_timestamps_callback(TestExecuteFlushesListVerifier); - grpc_http2_set_fn_get_copied_context(DummyArgsCopier); + grpc_http2_set_fn_get_copied_context(PhonyArgsCopier); } }; @@ -68,7 +68,7 @@ TEST_F(ContextListTest, ExecuteFlushesList) { const int kNumElems = 5; grpc_core::ExecCtx exec_ctx; grpc_stream_refcount ref; - GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "dummy ref"); + GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "phony ref"); grpc_resource_quota* resource_quota = grpc_resource_quota_create("context_list_test"); grpc_endpoint* mock_endpoint = @@ -124,7 +124,7 @@ TEST_F(ContextListTest, NonEmptyListEmptyTimestamp) { const int kNumElems = 5; grpc_core::ExecCtx exec_ctx; grpc_stream_refcount ref; - GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "dummy ref"); + GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "phony ref"); grpc_resource_quota* resource_quota = grpc_resource_quota_create("context_list_test"); grpc_endpoint* mock_endpoint = diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index f914fdd7a53..c97bd8a4af5 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -1495,9 +1495,9 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest { EXPECT_EQ(::grpc::StatusCode::CANCELLED, recv_status.error_code()); cli_cq.Shutdown(); - void* dummy_tag; - bool dummy_ok; - while (cli_cq.Next(&dummy_tag, &dummy_ok)) { + void* phony_tag; + bool phony_ok; + while (cli_cq.Next(&phony_tag, &phony_ok)) { } } @@ -1644,9 +1644,9 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest { EXPECT_EQ(::grpc::StatusCode::CANCELLED, recv_status.error_code()); cli_cq.Shutdown(); - void* dummy_tag; - bool dummy_ok; - while (cli_cq.Next(&dummy_tag, &dummy_ok)) { + void* phony_tag; + bool phony_ok; + while (cli_cq.Next(&phony_tag, &phony_ok)) { } } diff --git a/test/cpp/end2end/client_callback_end2end_test.cc b/test/cpp/end2end/client_callback_end2end_test.cc index 7df79464a40..353cc3a369d 100644 --- a/test/cpp/end2end/client_callback_end2end_test.cc +++ b/test/cpp/end2end/client_callback_end2end_test.cc @@ -120,10 +120,10 @@ class ClientCallbackEnd2endTest std::vector< std::unique_ptr> creators; - // Add 20 dummy server interceptors + // Add 20 phony server interceptors creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); } @@ -148,7 +148,7 @@ class ClientCallbackEnd2endTest } else { channel_ = CreateCustomChannelWithInterceptors( server_address_.str(), channel_creds, args, - CreateDummyClientInterceptors()); + CreatePhonyClientInterceptors()); } break; case Protocol::INPROC: @@ -156,7 +156,7 @@ class ClientCallbackEnd2endTest channel_ = server_->InProcessChannel(args); } else { channel_ = server_->experimental().InProcessChannelWithInterceptors( - args, CreateDummyClientInterceptors()); + args, CreatePhonyClientInterceptors()); } break; default: @@ -164,7 +164,7 @@ class ClientCallbackEnd2endTest } stub_ = grpc::testing::EchoTestService::NewStub(channel_); generic_stub_ = absl::make_unique(channel_); - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); } void TearDown() override { @@ -607,7 +607,7 @@ TEST_P(ClientCallbackEnd2endTest, CancelRpcBeforeStart) { cv.wait(l); } if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -749,7 +749,7 @@ TEST_P(ClientCallbackEnd2endTest, RequestStream) { test.Await(); // Make sure that the server interceptors were not notified to cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -760,7 +760,7 @@ TEST_P(ClientCallbackEnd2endTest, ClientCancelsRequestStream) { test.Await(); // Make sure that the server interceptors got the cancel if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -772,7 +772,7 @@ TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelBeforeReads) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -784,7 +784,7 @@ TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelDuringRead) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -797,7 +797,7 @@ TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelAfterReads) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -856,7 +856,7 @@ TEST_P(ClientCallbackEnd2endTest, UnaryReactor) { test.Await(); // Make sure that the server interceptors were not notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -922,7 +922,7 @@ TEST_P(ClientCallbackEnd2endTest, GenericUnaryReactor) { test.Await(); // Make sure that the server interceptors were not notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1033,7 +1033,7 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStream) { test.Await(); // Make sure that the server interceptors were not notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1054,7 +1054,7 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelBefore) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1066,7 +1066,7 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelDuring) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1079,7 +1079,7 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelAfter) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1246,7 +1246,7 @@ TEST_P(ClientCallbackEnd2endTest, BidiStream) { test.Await(); // Make sure that the server interceptors were not notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1259,7 +1259,7 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamFirstWriteAsync) { test.Await(); // Make sure that the server interceptors were not notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1272,7 +1272,7 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamCorked) { test.Await(); // Make sure that the server interceptors were not notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1285,7 +1285,7 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamCorkedFirstWriteAsync) { test.Await(); // Make sure that the server interceptors were not notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(0, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(0, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1299,7 +1299,7 @@ TEST_P(ClientCallbackEnd2endTest, ClientCancelsBidiStream) { test.Await(); // Make sure that the server interceptors were notified of a cancel if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1312,7 +1312,7 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelBefore) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1327,7 +1327,7 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelDuring) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1341,7 +1341,7 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelAfter) { test.Await(); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } diff --git a/test/cpp/end2end/client_interceptors_end2end_test.cc b/test/cpp/end2end/client_interceptors_end2end_test.cc index af454198eb2..5d9451c1518 100644 --- a/test/cpp/end2end/client_interceptors_end2end_test.cc +++ b/test/cpp/end2end/client_interceptors_end2end_test.cc @@ -826,19 +826,19 @@ class ParameterizedClientInterceptorsEnd2endTest TEST_P(ParameterizedClientInterceptorsEnd2endTest, ClientInterceptorLoggingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back(absl::make_unique()); - // Add 20 dummy interceptors + // Add 20 phony interceptors for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = CreateClientChannel(std::move(creators)); SendRPC(channel); LoggingInterceptor::VerifyCall(GetParam().rpc_type()); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } INSTANTIATE_TEST_SUITE_P(ParameterizedClientInterceptorsEnd2end, @@ -878,24 +878,24 @@ TEST_F(ClientInterceptorsEnd2endTest, TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorHijackingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; - // Add 20 dummy interceptors before hijacking interceptor + // Add 20 phony interceptors before hijacking interceptor creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } creators.push_back(absl::make_unique()); - // Add 20 dummy interceptors after hijacking interceptor + // Add 20 phony interceptors after hijacking interceptor for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeCall(channel); - // Make sure only 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure only 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorLogThenHijackTest) { @@ -913,20 +913,20 @@ TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorLogThenHijackTest) { TEST_F(ClientInterceptorsEnd2endTest, ClientInterceptorHijackingMakesAnotherCallTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; - // Add 5 dummy interceptors before hijacking interceptor + // Add 5 phony interceptors before hijacking interceptor creators.reserve(5); for (auto i = 0; i < 5; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } creators.push_back( std::unique_ptr( new HijackingInterceptorMakesAnotherCallFactory())); - // Add 7 dummy interceptors after hijacking interceptor + // Add 7 phony interceptors after hijacking interceptor for (auto i = 0; i < 7; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = server_->experimental().InProcessChannelWithInterceptors( args, std::move(creators)); @@ -934,7 +934,7 @@ TEST_F(ClientInterceptorsEnd2endTest, MakeCall(channel); // Make sure all interceptors were run once, since the hijacking interceptor // makes an RPC on the intercepted channel - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 12); + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 12); } class ClientInterceptorsCallbackEnd2endTest : public ::testing::Test { @@ -959,40 +959,40 @@ class ClientInterceptorsCallbackEnd2endTest : public ::testing::Test { TEST_F(ClientInterceptorsCallbackEnd2endTest, ClientInterceptorLoggingTestWithCallback) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back(absl::make_unique()); - // Add 20 dummy interceptors + // Add 20 phony interceptors for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = server_->experimental().InProcessChannelWithInterceptors( args, std::move(creators)); MakeCallbackCall(channel); LoggingInterceptor::VerifyUnaryCall(); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } TEST_F(ClientInterceptorsCallbackEnd2endTest, ClientInterceptorFactoryAllowsNullptrReturn) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back(absl::make_unique()); - // Add 20 dummy interceptors and 20 null interceptors + // Add 20 phony interceptors and 20 null interceptors for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); creators.push_back(absl::make_unique()); } auto channel = server_->experimental().InProcessChannelWithInterceptors( args, std::move(creators)); MakeCallbackCall(channel); LoggingInterceptor::VerifyUnaryCall(); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } class ClientInterceptorsStreamingEnd2endTest : public ::testing::Test { @@ -1016,38 +1016,38 @@ class ClientInterceptorsStreamingEnd2endTest : public ::testing::Test { TEST_F(ClientInterceptorsStreamingEnd2endTest, ClientStreamingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back(absl::make_unique()); - // Add 20 dummy interceptors + // Add 20 phony interceptors for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeClientStreamingCall(channel); LoggingInterceptor::VerifyClientStreamingCall(); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } TEST_F(ClientInterceptorsStreamingEnd2endTest, ServerStreamingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back(absl::make_unique()); - // Add 20 dummy interceptors + // Add 20 phony interceptors for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeServerStreamingCall(channel); LoggingInterceptor::VerifyServerStreamingCall(); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } TEST_F(ClientInterceptorsStreamingEnd2endTest, ClientStreamingHijackingTest) { @@ -1080,7 +1080,7 @@ TEST_F(ClientInterceptorsStreamingEnd2endTest, ClientStreamingHijackingTest) { TEST_F(ClientInterceptorsStreamingEnd2endTest, ServerStreamingHijackingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back( @@ -1094,7 +1094,7 @@ TEST_F(ClientInterceptorsStreamingEnd2endTest, ServerStreamingHijackingTest) { TEST_F(ClientInterceptorsStreamingEnd2endTest, AsyncCQServerStreamingHijackingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back( @@ -1107,7 +1107,7 @@ TEST_F(ClientInterceptorsStreamingEnd2endTest, TEST_F(ClientInterceptorsStreamingEnd2endTest, BidiStreamingHijackingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back( @@ -1119,20 +1119,20 @@ TEST_F(ClientInterceptorsStreamingEnd2endTest, BidiStreamingHijackingTest) { TEST_F(ClientInterceptorsStreamingEnd2endTest, BidiStreamingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; creators.push_back(absl::make_unique()); - // Add 20 dummy interceptors + // Add 20 phony interceptors for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeBidiStreamingCall(channel); LoggingInterceptor::VerifyBidiStreamingCall(); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } class ClientGlobalInterceptorEnd2endTest : public ::testing::Test { @@ -1154,26 +1154,26 @@ class ClientGlobalInterceptorEnd2endTest : public ::testing::Test { std::unique_ptr server_; }; -TEST_F(ClientGlobalInterceptorEnd2endTest, DummyGlobalInterceptor) { +TEST_F(ClientGlobalInterceptorEnd2endTest, PhonyGlobalInterceptor) { // We should ideally be registering a global interceptor only once per // process, but for the purposes of testing, it should be fine to modify the // registered global interceptor when there are no ongoing gRPC operations - DummyInterceptorFactory global_factory; + PhonyInterceptorFactory global_factory; experimental::RegisterGlobalClientInterceptorFactory(&global_factory); ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; - // Add 20 dummy interceptors + // Add 20 phony interceptors creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeCall(channel); - // Make sure all 20 dummy interceptors were run with the global interceptor - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 21); + // Make sure all 20 phony interceptors were run with the global interceptor + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 21); experimental::TestOnlyResetGlobalClientInterceptorFactory(); } @@ -1184,20 +1184,20 @@ TEST_F(ClientGlobalInterceptorEnd2endTest, LoggingGlobalInterceptor) { LoggingInterceptorFactory global_factory; experimental::RegisterGlobalClientInterceptorFactory(&global_factory); ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; - // Add 20 dummy interceptors + // Add 20 phony interceptors creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeCall(channel); LoggingInterceptor::VerifyUnaryCall(); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); experimental::TestOnlyResetGlobalClientInterceptorFactory(); } @@ -1208,19 +1208,19 @@ TEST_F(ClientGlobalInterceptorEnd2endTest, HijackingGlobalInterceptor) { HijackingInterceptorFactory global_factory; experimental::RegisterGlobalClientInterceptorFactory(&global_factory); ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; - // Add 20 dummy interceptors + // Add 20 phony interceptors creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } auto channel = experimental::CreateCustomChannelWithInterceptors( server_address_, InsecureChannelCredentials(), args, std::move(creators)); MakeCall(channel); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); experimental::TestOnlyResetGlobalClientInterceptorFactory(); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 906d0fa5160..17dec96d1db 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -376,10 +376,10 @@ class End2endTest : public ::testing::TestWithParam { std::vector< std::unique_ptr> creators; - // Add 20 dummy server interceptors + // Add 20 phony server interceptors creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); } @@ -428,7 +428,7 @@ class End2endTest : public ::testing::TestWithParam { } else { channel_ = CreateCustomChannelWithInterceptors( server_address_.str(), channel_creds, args, - interceptor_creators.empty() ? CreateDummyClientInterceptors() + interceptor_creators.empty() ? CreatePhonyClientInterceptors() : std::move(interceptor_creators)); } } else { @@ -437,7 +437,7 @@ class End2endTest : public ::testing::TestWithParam { } else { channel_ = server_->experimental().InProcessChannelWithInterceptors( args, interceptor_creators.empty() - ? CreateDummyClientInterceptors() + ? CreatePhonyClientInterceptors() : std::move(interceptor_creators)); } } @@ -468,7 +468,7 @@ class End2endTest : public ::testing::TestWithParam { } stub_ = grpc::testing::EchoTestService::NewStub(channel_); - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); } bool do_not_test_{false}; @@ -587,7 +587,7 @@ class End2endServerTryCancelTest : public End2endTest { EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code()); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -669,7 +669,7 @@ class End2endServerTryCancelTest : public End2endTest { EXPECT_FALSE(s.ok()); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -758,7 +758,7 @@ class End2endServerTryCancelTest : public End2endTest { EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code()); // Make sure that the server interceptors were notified if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } }; @@ -1205,7 +1205,7 @@ TEST_P(End2endTest, CancelRpcBeforeStart) { EXPECT_EQ("", response.message()); EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code()); if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1241,7 +1241,7 @@ TEST_P(End2endTest, CancelRpcAfterStart) { EXPECT_EQ("", response.message()); EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code()); if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1265,7 +1265,7 @@ TEST_P(End2endTest, ClientCancelsRequestStream) { EXPECT_EQ(response.message(), ""); if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1301,7 +1301,7 @@ TEST_P(End2endTest, ClientCancelsResponseStream) { // who won the race. EXPECT_GE(grpc::StatusCode::CANCELLED, s.error_code()); if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } @@ -1338,7 +1338,7 @@ TEST_P(End2endTest, ClientCancelsBidi) { Status s = stream->Finish(); EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code()); if (GetParam().use_interceptors) { - EXPECT_EQ(20, DummyInterceptor::GetNumTimesCancel()); + EXPECT_EQ(20, PhonyInterceptor::GetNumTimesCancel()); } } diff --git a/test/cpp/end2end/interceptors_util.cc b/test/cpp/end2end/interceptors_util.cc index b977342d1d4..875ae8fd41e 100644 --- a/test/cpp/end2end/interceptors_util.cc +++ b/test/cpp/end2end/interceptors_util.cc @@ -23,9 +23,9 @@ namespace grpc { namespace testing { -std::atomic DummyInterceptor::num_times_run_; -std::atomic DummyInterceptor::num_times_run_reverse_; -std::atomic DummyInterceptor::num_times_cancel_; +std::atomic PhonyInterceptor::num_times_run_; +std::atomic PhonyInterceptor::num_times_run_reverse_; +std::atomic PhonyInterceptor::num_times_cancel_; void MakeCall(const std::shared_ptr& channel) { auto stub = grpc::testing::EchoTestService::NewStub(channel); @@ -199,13 +199,13 @@ bool CheckMetadata(const std::multimap& map, } std::vector> -CreateDummyClientInterceptors() { +CreatePhonyClientInterceptors() { std::vector> creators; - // Add 20 dummy interceptors before hijacking interceptor + // Add 20 phony interceptors before hijacking interceptor creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } return creators; } diff --git a/test/cpp/end2end/interceptors_util.h b/test/cpp/end2end/interceptors_util.h index 0b386b3cd27..b6ffd7e6640 100644 --- a/test/cpp/end2end/interceptors_util.h +++ b/test/cpp/end2end/interceptors_util.h @@ -29,9 +29,9 @@ namespace grpc { namespace testing { /* This interceptor does nothing. Just keeps a global count on the number of * times it was invoked. */ -class DummyInterceptor : public experimental::Interceptor { +class PhonyInterceptor : public experimental::Interceptor { public: - DummyInterceptor() {} + PhonyInterceptor() {} void Intercept(experimental::InterceptorBatchMethods* methods) override { if (methods->QueryInterceptionHookPoint( @@ -67,18 +67,18 @@ class DummyInterceptor : public experimental::Interceptor { static std::atomic num_times_cancel_; }; -class DummyInterceptorFactory +class PhonyInterceptorFactory : public experimental::ClientInterceptorFactoryInterface, public experimental::ServerInterceptorFactoryInterface { public: experimental::Interceptor* CreateClientInterceptor( experimental::ClientRpcInfo* /*info*/) override { - return new DummyInterceptor(); + return new PhonyInterceptor(); } experimental::Interceptor* CreateServerInterceptor( experimental::ServerRpcInfo* /*info*/) override { - return new DummyInterceptor(); + return new PhonyInterceptor(); } }; @@ -189,7 +189,7 @@ bool CheckMetadata(const std::multimap& map, const string& key, const string& value); std::vector> -CreateDummyClientInterceptors(); +CreatePhonyClientInterceptors(); inline void* tag(int i) { return reinterpret_cast(i); } inline int detag(void* p) { diff --git a/test/cpp/end2end/server_interceptors_end2end_test.cc b/test/cpp/end2end/server_interceptors_end2end_test.cc index 43457343c65..8145c8ca4f6 100644 --- a/test/cpp/end2end/server_interceptors_end2end_test.cc +++ b/test/cpp/end2end/server_interceptors_end2end_test.cc @@ -252,9 +252,9 @@ class ServerInterceptorsEnd2endSyncUnaryTest : public ::testing::Test { creators.push_back( std::unique_ptr( new LoggingInterceptorFactory())); - // Add 20 dummy interceptor factories and null interceptor factories + // Add 20 phony interceptor factories and null interceptor factories for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); @@ -267,12 +267,12 @@ class ServerInterceptorsEnd2endSyncUnaryTest : public ::testing::Test { TEST_F(ServerInterceptorsEnd2endSyncUnaryTest, UnaryTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials()); MakeCall(channel); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } class ServerInterceptorsEnd2endSyncStreamingTest : public ::testing::Test { @@ -298,7 +298,7 @@ class ServerInterceptorsEnd2endSyncStreamingTest : public ::testing::Test { std::unique_ptr( new LoggingInterceptorFactory())); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); server_ = builder.BuildAndStart(); @@ -310,38 +310,38 @@ class ServerInterceptorsEnd2endSyncStreamingTest : public ::testing::Test { TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, ClientStreamingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials()); MakeClientStreamingCall(channel); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, ServerStreamingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials()); MakeServerStreamingCall(channel); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } TEST_F(ServerInterceptorsEnd2endSyncStreamingTest, BidiStreamingTest) { ChannelArguments args; - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); auto channel = grpc::CreateChannel(server_address_, InsecureChannelCredentials()); MakeBidiStreamingCall(channel); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); } class ServerInterceptorsAsyncEnd2endTest : public ::testing::Test {}; TEST_F(ServerInterceptorsAsyncEnd2endTest, UnaryTest) { - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); int port = grpc_pick_unused_port_or_die(); string server_address = "localhost:" + std::to_string(port); ServerBuilder builder; @@ -354,7 +354,7 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, UnaryTest) { std::unique_ptr( new LoggingInterceptorFactory())); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); auto cq = builder.AddCompletionQueue(); @@ -400,8 +400,8 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, UnaryTest) { EXPECT_TRUE(CheckMetadata(cli_ctx.GetServerTrailingMetadata(), "testkey", "testvalue")); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); server->Shutdown(); cq->Shutdown(); @@ -413,7 +413,7 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, UnaryTest) { } TEST_F(ServerInterceptorsAsyncEnd2endTest, BidiStreamingTest) { - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); int port = grpc_pick_unused_port_or_die(); string server_address = "localhost:" + std::to_string(port); ServerBuilder builder; @@ -426,7 +426,7 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, BidiStreamingTest) { std::unique_ptr( new LoggingInterceptorFactory())); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); auto cq = builder.AddCompletionQueue(); @@ -482,8 +482,8 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, BidiStreamingTest) { EXPECT_TRUE(CheckMetadata(cli_ctx.GetServerTrailingMetadata(), "testkey", "testvalue")); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); server->Shutdown(); cq->Shutdown(); @@ -495,7 +495,7 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, BidiStreamingTest) { } TEST_F(ServerInterceptorsAsyncEnd2endTest, GenericRPCTest) { - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); int port = grpc_pick_unused_port_or_die(); string server_address = "localhost:" + std::to_string(port); ServerBuilder builder; @@ -506,7 +506,7 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, GenericRPCTest) { creators; creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); auto srv_cq = builder.AddCompletionQueue(); @@ -588,8 +588,8 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, GenericRPCTest) { EXPECT_TRUE(CheckMetadata(cli_ctx.GetServerTrailingMetadata(), "testkey", "testvalue")); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); server->Shutdown(); void* ignored_tag; @@ -602,7 +602,7 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, GenericRPCTest) { } TEST_F(ServerInterceptorsAsyncEnd2endTest, UnimplementedRpcTest) { - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); int port = grpc_pick_unused_port_or_die(); string server_address = "localhost:" + std::to_string(port); ServerBuilder builder; @@ -611,7 +611,7 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, UnimplementedRpcTest) { creators; creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); auto cq = builder.AddCompletionQueue(); @@ -637,8 +637,8 @@ TEST_F(ServerInterceptorsAsyncEnd2endTest, UnimplementedRpcTest) { EXPECT_EQ(StatusCode::UNIMPLEMENTED, recv_status.error_code()); EXPECT_EQ("", recv_status.error_message()); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); server->Shutdown(); cq->Shutdown(); @@ -653,7 +653,7 @@ class ServerInterceptorsSyncUnimplementedEnd2endTest : public ::testing::Test { }; TEST_F(ServerInterceptorsSyncUnimplementedEnd2endTest, UnimplementedRpcTest) { - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); int port = grpc_pick_unused_port_or_die(); string server_address = "localhost:" + std::to_string(port); ServerBuilder builder; @@ -664,7 +664,7 @@ TEST_F(ServerInterceptorsSyncUnimplementedEnd2endTest, UnimplementedRpcTest) { creators; creators.reserve(20); for (auto i = 0; i < 20; i++) { - creators.push_back(absl::make_unique()); + creators.push_back(absl::make_unique()); } builder.experimental().SetInterceptorCreators(std::move(creators)); auto server = builder.BuildAndStart(); @@ -685,8 +685,8 @@ TEST_F(ServerInterceptorsSyncUnimplementedEnd2endTest, UnimplementedRpcTest) { EXPECT_EQ(StatusCode::UNIMPLEMENTED, recv_status.error_code()); EXPECT_EQ("", recv_status.error_message()); - // Make sure all 20 dummy interceptors were run - EXPECT_EQ(DummyInterceptor::GetNumTimesRun(), 20); + // Make sure all 20 phony interceptors were run + EXPECT_EQ(PhonyInterceptor::GetNumTimesRun(), 20); server->Shutdown(); grpc_recycle_unused_port(port); diff --git a/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm index 53ab3f710be..1e582a14749 100644 --- a/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm +++ b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm @@ -574,11 +574,11 @@ using grpc::ClientContext; } - (void)testClientInterceptor { - DummyInterceptor::Reset(); + PhonyInterceptor::Reset(); std::vector> creators; - // Add 20 dummy interceptors + // Add 20 phony interceptors for (auto i = 0; i < 20; i++) { - creators.push_back(std::unique_ptr(new DummyInterceptorFactory())); + creators.push_back(std::unique_ptr(new PhonyInterceptorFactory())); } auto channel = [self getChannelWithInterceptors:std::move(creators)]; auto stub = EchoTestService::NewStub(channel); @@ -589,7 +589,7 @@ using grpc::ClientContext; request.set_message("Hello"); Status s = stub->Echo(&context, request, &response); XCTAssertTrue(s.ok()); - XCTAssertEqual(DummyInterceptor::GetNumTimesRun(), 20); + XCTAssertEqual(PhonyInterceptor::GetNumTimesRun(), 20); } @end diff --git a/test/cpp/ios/CronetTests/TestHelper.h b/test/cpp/ios/CronetTests/TestHelper.h index 0375d3d70f0..f24dcd63f5c 100644 --- a/test/cpp/ios/CronetTests/TestHelper.h +++ b/test/cpp/ios/CronetTests/TestHelper.h @@ -38,9 +38,9 @@ std::string ToString(const grpc::string_ref& r); void configureCronet(void); bool CheckIsLocalhost(const std::string& addr); -class DummyInterceptor : public grpc::experimental::Interceptor { +class PhonyInterceptor : public grpc::experimental::Interceptor { public: - DummyInterceptor() {} + PhonyInterceptor() {} virtual void Intercept(grpc::experimental::InterceptorBatchMethods* methods); static void Reset(); static int GetNumTimesRun(); @@ -50,12 +50,12 @@ class DummyInterceptor : public grpc::experimental::Interceptor { static std::atomic num_times_run_reverse_; }; -class DummyInterceptorFactory +class PhonyInterceptorFactory : public grpc::experimental::ClientInterceptorFactoryInterface { public: virtual grpc::experimental::Interceptor* CreateClientInterceptor( grpc::experimental::ClientRpcInfo* info) override { - return new DummyInterceptor(); + return new PhonyInterceptor(); } }; diff --git a/test/cpp/ios/CronetTests/TestHelper.mm b/test/cpp/ios/CronetTests/TestHelper.mm index a5c69e3f7c4..0cb7e7ce036 100644 --- a/test/cpp/ios/CronetTests/TestHelper.mm +++ b/test/cpp/ios/CronetTests/TestHelper.mm @@ -28,8 +28,8 @@ using grpc::testing::EchoTestService; using grpc::ServerContext; using grpc::Status; -std::atomic DummyInterceptor::num_times_run_; -std::atomic DummyInterceptor::num_times_run_reverse_; +std::atomic PhonyInterceptor::num_times_run_; +std::atomic PhonyInterceptor::num_times_run_reverse_; std::string ToString(const grpc::string_ref& r) { return std::string(r.data(), r.size()); } @@ -175,7 +175,7 @@ Status TestServiceImpl::BidiStream(ServerContext* context, return Status::OK; } -void DummyInterceptor::Intercept(grpc::experimental::InterceptorBatchMethods* methods) { +void PhonyInterceptor::Intercept(grpc::experimental::InterceptorBatchMethods* methods) { if (methods->QueryInterceptionHookPoint( grpc::experimental::InterceptionHookPoints::PRE_SEND_INITIAL_METADATA)) { num_times_run_++; @@ -186,12 +186,12 @@ void DummyInterceptor::Intercept(grpc::experimental::InterceptorBatchMethods* me methods->Proceed(); } -void DummyInterceptor::Reset() { +void PhonyInterceptor::Reset() { num_times_run_.store(0); num_times_run_reverse_.store(0); } -int DummyInterceptor::GetNumTimesRun() { +int PhonyInterceptor::GetNumTimesRun() { NSCAssert(num_times_run_.load() == num_times_run_reverse_.load(), @"Interceptor must run same number of times in both directions"); return num_times_run_.load(); diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index e167f40bbe4..3bd7ef01325 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -343,7 +343,7 @@ struct Fixture { const uint32_t flags = kFlags; }; -namespace dummy_filter { +namespace phony_filter { static void StartTransportStreamOp(grpc_call_element* /*elem*/, grpc_transport_stream_op_batch* /*op*/) {} @@ -373,7 +373,7 @@ void DestroyChannelElem(grpc_channel_element* /*elem*/) {} void GetChannelInfo(grpc_channel_element* /*elem*/, const grpc_channel_info* /*channel_info*/) {} -static const grpc_channel_filter dummy_filter = {StartTransportStreamOp, +static const grpc_channel_filter phony_filter = {StartTransportStreamOp, StartTransportOp, 0, InitCallElem, @@ -383,11 +383,11 @@ static const grpc_channel_filter dummy_filter = {StartTransportStreamOp, InitChannelElem, DestroyChannelElem, GetChannelInfo, - "dummy_filter"}; + "phony_filter"}; -} // namespace dummy_filter +} // namespace phony_filter -namespace dummy_transport { +namespace phony_transport { /* Memory required for a single stream element - this is allocated by upper layers and initialized by the transport */ @@ -430,15 +430,15 @@ void Destroy(grpc_transport* /*self*/) {} /* implementation of grpc_transport_get_endpoint */ grpc_endpoint* GetEndpoint(grpc_transport* /*self*/) { return nullptr; } -static const grpc_transport_vtable dummy_transport_vtable = { - 0, "dummy_http2", InitStream, +static const grpc_transport_vtable phony_transport_vtable = { + 0, "phony_http2", InitStream, SetPollset, SetPollsetSet, PerformStreamOp, PerformOp, DestroyStream, Destroy, GetEndpoint}; -static grpc_transport dummy_transport = {&dummy_transport_vtable}; +static grpc_transport phony_transport = {&phony_transport_vtable}; -} // namespace dummy_transport +} // namespace phony_transport class NoOp { public: @@ -502,8 +502,8 @@ static void BM_IsolatedFilter(benchmark::State& state) { filters.push_back(fixture.filter); } if (fixture.flags & CHECKS_NOT_LAST) { - filters.push_back(&dummy_filter::dummy_filter); - label << " #has_dummy_filter"; + filters.push_back(&phony_filter::phony_filter); + label << " #has_phony_filter"; } grpc_core::ExecCtx exec_ctx; @@ -517,7 +517,7 @@ static void BM_IsolatedFilter(benchmark::State& state) { filters.empty() ? nullptr : &filters[0], filters.size(), &channel_args, fixture.flags & REQUIRES_TRANSPORT - ? &dummy_transport::dummy_transport + ? &phony_transport::phony_transport : nullptr, "CHANNEL", channel_stack))); grpc_core::ExecCtx::Get()->Flush(); @@ -565,9 +565,9 @@ static void BM_IsolatedFilter(benchmark::State& state) { typedef Fixture NoFilter; BENCHMARK_TEMPLATE(BM_IsolatedFilter, NoFilter, NoOp); -typedef Fixture<&dummy_filter::dummy_filter, 0> DummyFilter; -BENCHMARK_TEMPLATE(BM_IsolatedFilter, DummyFilter, NoOp); -BENCHMARK_TEMPLATE(BM_IsolatedFilter, DummyFilter, SendEmptyMetadata); +typedef Fixture<&phony_filter::phony_filter, 0> PhonyFilter; +BENCHMARK_TEMPLATE(BM_IsolatedFilter, PhonyFilter, NoOp); +BENCHMARK_TEMPLATE(BM_IsolatedFilter, PhonyFilter, SendEmptyMetadata); typedef Fixture<&grpc_client_channel_filter, 0> ClientChannelFilter; BENCHMARK_TEMPLATE(BM_IsolatedFilter, ClientChannelFilter, NoOp); typedef Fixture<&grpc_message_compress_filter, CHECKS_NOT_LAST> CompressFilter; @@ -691,8 +691,8 @@ class IsolatedCallFixture : public TrackCounters { // call grpc_init() manually here to balance things out. grpc_init(); grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create(); - grpc_channel_stack_builder_set_name(builder, "dummy"); - grpc_channel_stack_builder_set_target(builder, "dummy_target"); + grpc_channel_stack_builder_set_name(builder, "phony"); + grpc_channel_stack_builder_set_target(builder, "phony_target"); GPR_ASSERT(grpc_channel_stack_builder_append_filter( builder, &isolated_call_filter::isolated_call_filter, nullptr, nullptr)); diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 3c8822a4d65..45144017d5b 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -41,9 +41,9 @@ // Helper classes // -class DummyEndpoint : public grpc_endpoint { +class PhonyEndpoint : public grpc_endpoint { public: - DummyEndpoint() { + PhonyEndpoint() { static const grpc_endpoint_vtable my_vtable = {read, write, add_to_pollset, @@ -58,7 +58,7 @@ class DummyEndpoint : public grpc_endpoint { can_track_err}; grpc_endpoint::vtable = &my_vtable; ru_ = grpc_resource_user_create(LibraryInitializer::get().rq(), - "dummy_endpoint"); + "phony_endpoint"); } void PushInput(grpc_slice slice) { @@ -94,7 +94,7 @@ class DummyEndpoint : public grpc_endpoint { static void read(grpc_endpoint* ep, grpc_slice_buffer* slices, grpc_closure* cb, bool /*urgent*/) { - static_cast(ep)->QueueRead(slices, cb); + static_cast(ep)->QueueRead(slices, cb); } static void write(grpc_endpoint* /*ep*/, grpc_slice_buffer* /*slices*/, @@ -112,18 +112,18 @@ class DummyEndpoint : public grpc_endpoint { grpc_pollset_set* /*pollset*/) {} static void shutdown(grpc_endpoint* ep, grpc_error* why) { - grpc_resource_user_shutdown(static_cast(ep)->ru_); + grpc_resource_user_shutdown(static_cast(ep)->ru_); grpc_core::ExecCtx::Run(DEBUG_LOCATION, - static_cast(ep)->read_cb_, why); + static_cast(ep)->read_cb_, why); } static void destroy(grpc_endpoint* ep) { - grpc_resource_user_unref(static_cast(ep)->ru_); - delete static_cast(ep); + grpc_resource_user_unref(static_cast(ep)->ru_); + delete static_cast(ep); } static grpc_resource_user* get_resource_user(grpc_endpoint* ep) { - return static_cast(ep)->ru_; + return static_cast(ep)->ru_; } static absl::string_view get_peer(grpc_endpoint* /*ep*/) { return "test"; } static absl::string_view get_local_address(grpc_endpoint* /*ep*/) { @@ -137,7 +137,7 @@ class Fixture { public: Fixture(const grpc::ChannelArguments& args, bool client) { grpc_channel_args c_args = args.c_channel_args(); - ep_ = new DummyEndpoint; + ep_ = new PhonyEndpoint; t_ = grpc_create_chttp2_transport(&c_args, ep_, client); grpc_chttp2_transport_start_reading(t_, nullptr, nullptr); FlushExecCtx(); @@ -155,7 +155,7 @@ class Fixture { void PushInput(grpc_slice slice) { ep_->PushInput(slice); } private: - DummyEndpoint* ep_; + PhonyEndpoint* ep_; grpc_transport* t_; }; diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 8ce70c3ced2..e7b28240ba5 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -74,7 +74,7 @@ static void DoneWithCompletionOnHeap(void* /*arg*/, delete completion; } -class DummyTag final : public internal::CompletionQueueTag { +class PhonyTag final : public internal::CompletionQueueTag { public: bool FinalizeResult(void** /*tag*/, bool* /*status*/) override { return true; @@ -87,10 +87,10 @@ static void BM_Pass1Cpp(benchmark::State& state) { grpc_completion_queue* c_cq = cq.cq(); for (auto _ : state) { grpc_cq_completion completion; - DummyTag dummy_tag; + PhonyTag phony_tag; grpc_core::ExecCtx exec_ctx; - GPR_ASSERT(grpc_cq_begin_op(c_cq, &dummy_tag)); - grpc_cq_end_op(c_cq, &dummy_tag, GRPC_ERROR_NONE, DoneWithCompletionOnStack, + GPR_ASSERT(grpc_cq_begin_op(c_cq, &phony_tag)); + grpc_cq_end_op(c_cq, &phony_tag, GRPC_ERROR_NONE, DoneWithCompletionOnStack, nullptr, &completion); void* tag; diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc index 052be9e8dd6..1fdc38d7a28 100644 --- a/test/cpp/naming/resolver_component_test.cc +++ b/test/cpp/naming/resolver_component_test.cc @@ -289,11 +289,11 @@ void CheckLBPolicyResultLocked(const grpc_channel_args* channel_args, } #ifdef GPR_WINDOWS -void OpenAndCloseSocketsStressLoop(int dummy_port, gpr_event* done_ev) { +void OpenAndCloseSocketsStressLoop(int phony_port, gpr_event* done_ev) { sockaddr_in6 addr; memset(&addr, 0, sizeof(addr)); addr.sin6_family = AF_INET6; - addr.sin6_port = htons(dummy_port); + addr.sin6_port = htons(phony_port); ((char*)&addr.sin6_addr)[15] = 1; for (;;) { if (gpr_event_get(done_ev)) { @@ -315,7 +315,7 @@ void OpenAndCloseSocketsStressLoop(int dummy_port, gpr_event* done_ev) { << "Failed to set socket non-blocking"; ASSERT_TRUE(bind(s, (const sockaddr*)&addr, sizeof(addr)) != SOCKET_ERROR) << "Failed to bind socket " + std::to_string(s) + - " to [::1]:" + std::to_string(dummy_port) + + " to [::1]:" + std::to_string(phony_port) + ". WSA error: " + std::to_string(WSAGetLastError()); ASSERT_TRUE(listen(s, 1) != SOCKET_ERROR) << "Failed to listen on socket " + std::to_string(s) + @@ -327,7 +327,7 @@ void OpenAndCloseSocketsStressLoop(int dummy_port, gpr_event* done_ev) { for (size_t i = 0; i < sockets.size(); i++) { gpr_log(GPR_DEBUG, "non-blocking accept then close on %d", sockets[i]); ASSERT_TRUE(accept(sockets[i], nullptr, nullptr) == INVALID_SOCKET) - << "Accept on dummy socket unexpectedly accepted actual connection."; + << "Accept on phony socket unexpectedly accepted actual connection."; ASSERT_TRUE(WSAGetLastError() == WSAEWOULDBLOCK) << "OpenAndCloseSocketsStressLoop accept on socket " + std::to_string(sockets[i]) + @@ -344,7 +344,7 @@ void OpenAndCloseSocketsStressLoop(int dummy_port, gpr_event* done_ev) { return; } #else -void OpenAndCloseSocketsStressLoop(int dummy_port, gpr_event* done_ev) { +void OpenAndCloseSocketsStressLoop(int phony_port, gpr_event* done_ev) { // The goal of this loop is to catch socket // "use after close" bugs within the c-ares resolver by acting // like some separate thread doing I/O. @@ -359,7 +359,7 @@ void OpenAndCloseSocketsStressLoop(int dummy_port, gpr_event* done_ev) { sockaddr_in6 addr; memset(&addr, 0, sizeof(addr)); addr.sin6_family = AF_INET6; - addr.sin6_port = htons(dummy_port); + addr.sin6_port = htons(phony_port); (reinterpret_cast(&addr.sin6_addr))[15] = 1; for (;;) { if (gpr_event_get(done_ev)) { @@ -385,7 +385,7 @@ void OpenAndCloseSocketsStressLoop(int dummy_port, gpr_event* done_ev) { gpr_log(GPR_DEBUG, "Opened fd: %d", s); ASSERT_TRUE(bind(s, (const sockaddr*)&addr, sizeof(addr)) == 0) << "Failed to bind socket " + std::to_string(s) + - " to [::1]:" + std::to_string(dummy_port) + + " to [::1]:" + std::to_string(phony_port) + ". errno: " + std::to_string(errno); ASSERT_TRUE(listen(s, 1) == 0) << "Failed to listen on socket " + std::to_string(s) + @@ -651,10 +651,10 @@ TEST(ResolverComponentTest, TestResolvesRelevantRecords) { TEST(ResolverComponentTest, TestResolvesRelevantRecordsWithConcurrentFdStress) { // Start up background stress thread - int dummy_port = grpc_pick_unused_port_or_die(); + int phony_port = grpc_pick_unused_port_or_die(); gpr_event done_ev; gpr_event_init(&done_ev); - std::thread socket_stress_thread(OpenAndCloseSocketsStressLoop, dummy_port, + std::thread socket_stress_thread(OpenAndCloseSocketsStressLoop, phony_port, &done_ev); // Run the resolver test RunResolvesRelevantRecordsTest(ResultHandler::Create); diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 8d4f014cb50..c53abd5b9c0 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -664,10 +664,10 @@ bool RunQuit( workers[i], GetCredType(workers[i], per_worker_credential_types, credential_type), nullptr /* call creds */, {} /* interceptor creators */)); - Void dummy; + Void phony; grpc::ClientContext ctx; ctx.set_wait_for_ready(true); - Status s = stub->QuitWorker(&ctx, dummy, &dummy); + Status s = stub->QuitWorker(&ctx, phony, &phony); if (!s.ok()) { gpr_log(GPR_ERROR, "Worker %zu could not be properly quit because %s", i, s.error_message().c_str()); diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index 62bcb3bfe5b..858ccaa0f25 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -198,10 +198,10 @@ void JsonReporter::ReportQueriesPerCpuSec(const ScenarioResult& /*result*/) { void RpcReporter::ReportQPS(const ScenarioResult& result) { grpc::ClientContext context; grpc::Status status; - Void dummy; + Void phony; gpr_log(GPR_INFO, "RPC reporter sending scenario result to server"); - status = stub_->ReportScenario(&context, result, &dummy); + status = stub_->ReportScenario(&context, result, &phony); if (status.ok()) { gpr_log(GPR_INFO, "RpcReporter report RPC success!"); diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 13b3c248ac2..094e1c1c825 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -99,8 +99,8 @@ class BenchmarkServiceImpl final : public BenchmarkService::Service { return done.load(std::memory_order_relaxed); }); }); - SimpleResponse dummy; - auto cp = ClientPull(context, stream, &dummy); + SimpleResponse phony; + auto cp = ClientPull(context, stream, &phony); done.store(true, std::memory_order_relaxed); // can be lazy t.join(); if (!cp.ok()) { diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc index bbf9cc03682..5a19b4f9514 100644 --- a/test/cpp/util/grpc_tool_test.cc +++ b/test/cpp/util/grpc_tool_test.cc @@ -465,12 +465,12 @@ TEST_F(GrpcToolTest, ListOneMethod) { } TEST_F(GrpcToolTest, TypeNotFound) { - // Test input "grpc_cli type localhost: grpc.testing.DummyRequest" + // Test input "grpc_cli type localhost: grpc.testing.PhonyRequest" std::stringstream output_stream; const std::string server_address = SetUpServer(); const char* argv[] = {"grpc_cli", "type", server_address.c_str(), - "grpc.testing.DummyRequest"}; + "grpc.testing.PhonyRequest"}; EXPECT_TRUE(1 == GrpcToolMainLib(ArraySize(argv), argv, TestCliCredentials(), std::bind(PrintStream, &output_stream, diff --git a/test/distrib/php/distribtest.php b/test/distrib/php/distribtest.php index 236cb09ba29..2dcccd5b044 100644 --- a/test/distrib/php/distribtest.php +++ b/test/distrib/php/distribtest.php @@ -23,7 +23,7 @@ $channel = new Grpc\Channel('localhost:1000', [ $deadline = Grpc\Timeval::infFuture(); $call = new Grpc\Call($channel, - 'dummy_method', + 'phony_method', $deadline); $call->cancel(); From 459ceb026d078059947ac46eb4878744822e23fb Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 8 Feb 2021 15:49:05 -0800 Subject: [PATCH 2/4] Clarify the Future interface --- src/python/grpcio/grpc/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index abe87458c4f..6154666e349 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -489,7 +489,8 @@ class UnaryStreamClientInterceptor(six.with_metaclass(abc.ABCMeta)): An object that is both a Call for the RPC and an iterator of response values. Drawing response values from the returned Call-iterator may raise RpcError indicating termination of - the RPC with non-OK status. + the RPC with non-OK status. This object *should* also fulfill the + Future interface, though it may not. """ raise NotImplementedError() @@ -562,7 +563,8 @@ class StreamStreamClientInterceptor(six.with_metaclass(abc.ABCMeta)): An object that is both a Call for the RPC and an iterator of response values. Drawing response values from the returned Call-iterator may raise RpcError indicating termination of - the RPC with non-OK status. + the RPC with non-OK status. This object *should* also fulfill the + Future interface, though it may not. """ raise NotImplementedError() @@ -800,7 +802,8 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)): An object that is both a Call for the RPC and an iterator of response values. Drawing response values from the returned Call-iterator may raise RpcError indicating termination of the - RPC with non-OK status. + RPC with non-OK status. This object also fulfills the Future + interface. """ raise NotImplementedError() @@ -939,7 +942,8 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)): An object that is both a Call for the RPC and an iterator of response values. Drawing response values from the returned Call-iterator may raise RpcError indicating termination of the - RPC with non-OK status. + RPC with non-OK status. This object also fulfills the Future + interface. """ raise NotImplementedError() From 762a29cddf6470a28fb0540c0773b4b87d999096 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 9 Feb 2021 12:52:29 -0800 Subject: [PATCH 3/4] Integrate additional guarantee into existing statement --- src/python/grpcio/grpc/__init__.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 6154666e349..d91d956e52c 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -799,11 +799,10 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)): grpc.compression.Gzip. This is an EXPERIMENTAL option. Returns: - An object that is both a Call for the RPC and an iterator of - response values. Drawing response values from the returned - Call-iterator may raise RpcError indicating termination of the - RPC with non-OK status. This object also fulfills the Future - interface. + An object that is a Call for the RPC, an iterator of response + values, and a Future for the RPC. Drawing response values from the + returned Call-iterator may raise RpcError indicating termination of + the RPC with non-OK status. """ raise NotImplementedError() @@ -939,11 +938,10 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)): grpc.compression.Gzip. This is an EXPERIMENTAL option. Returns: - An object that is both a Call for the RPC and an iterator of - response values. Drawing response values from the returned - Call-iterator may raise RpcError indicating termination of the - RPC with non-OK status. This object also fulfills the Future - interface. + An object that is a Call for the RPC, an iterator of response + values, and a Future for the RPC. Drawing response values from the + returned Call-iterator may raise RpcError indicating termination of + the RPC with non-OK status. """ raise NotImplementedError() From 7bbefc8365290db216d0a57598a02085b1256e0c Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Wed, 10 Feb 2021 11:06:02 -0800 Subject: [PATCH 4/4] Revert "Merge pull request #25365 from gnossen/python_xds_creds" This reverts commit b80d374b933f6e82ca8773afa0ecc971ad6856c1, reversing changes made to df062598c0b3703b77297b503e927928bb52eed2. --- src/python/grpcio/grpc/__init__.py | 45 +------- .../grpc/_cython/_cygrpc/aio/server.pyx.pxi | 3 +- .../grpc/_cython/_cygrpc/credentials.pxd.pxi | 7 -- .../grpc/_cython/_cygrpc/credentials.pyx.pxi | 32 ------ .../grpcio/grpc/_cython/_cygrpc/grpc.pxi | 20 ---- .../grpc/_cython/_cygrpc/server.pyx.pxi | 4 +- src/python/grpcio/grpc/_server.py | 8 +- src/python/grpcio/grpc/_simple_stubs.py | 21 ++-- .../grpcio/grpc/experimental/__init__.py | 10 +- src/python/grpcio_tests/tests/tests.json | 1 - .../grpcio_tests/tests/unit/BUILD.bazel | 1 - .../unit/_cython/_cancel_many_calls_test.py | 10 +- .../tests/unit/_cython/_common.py | 2 +- .../_read_some_but_not_all_responses_test.py | 2 +- .../tests/unit/_cython/_server_test.py | 2 +- .../tests/unit/_cython/cygrpc_test.py | 32 +++--- .../tests/unit/_xds_credentials_test.py | 103 ------------------ 17 files changed, 56 insertions(+), 247 deletions(-) delete mode 100644 src/python/grpcio_tests/tests/unit/_xds_credentials_test.py diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index daceca3b59e..abe87458c4f 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1607,21 +1607,6 @@ def ssl_channel_credentials(root_certificates=None, certificate_chain)) -def xds_channel_credentials(fallback_credentials=None): - """Creates a ChannelCredentials for use with xDS. This is an EXPERIMENTAL - API. - - Args: - fallback_credentials: Credentials to use in case it is not possible to - establish a secure connection via xDS. If no fallback_credentials - argument is supplied, a default SSLChannelCredentials is used. - """ - fallback_credentials = ssl_channel_credentials( - ) if fallback_credentials is None else fallback_credentials - return ChannelCredentials( - _cygrpc.XDSChannelCredentials(fallback_credentials._credentials)) - - def metadata_call_credentials(metadata_plugin, name=None): """Construct CallCredentials from an AuthMetadataPlugin. @@ -1721,29 +1706,6 @@ def ssl_server_credentials(private_key_certificate_chain_pairs, ], require_client_auth)) -def xds_server_credentials(fallback_credentials): - """Creates a ServerCredentials for use with xDS. This is an EXPERIMENTAL - API. - - Args: - fallback_credentials: Credentials to use in case it is not possible to - establish a secure connection via xDS. No default value is provided. - """ - return ServerCredentials( - _cygrpc.xds_server_credentials(fallback_credentials._credentials)) - - -def insecure_server_credentials(): - """Creates a credentials object directing the server to use no credentials. - This is an EXPERIMENTAL API. - - This object cannot be used directly in a call to `add_secure_port`. - Instead, it should be used to construct other credentials objects, e.g. - with xds_server_credentials. - """ - return ServerCredentials(_cygrpc.insecure_server_credentials()) - - def ssl_server_certificate_configuration(private_key_certificate_chain_pairs, root_certificates=None): """Creates a ServerCertificateConfiguration for use with a Server. @@ -2019,8 +1981,7 @@ def server(thread_pool, interceptors=None, options=None, maximum_concurrent_rpcs=None, - compression=None, - xds=False): + compression=None): """Creates a Server with which RPCs can be serviced. Args: @@ -2041,8 +2002,6 @@ def server(thread_pool, compression: An element of grpc.compression, e.g. grpc.compression.Gzip. This compression algorithm will be used for the lifetime of the server unless overridden. This is an EXPERIMENTAL option. - xds: If set to true, retrieves server configuration via xDS. This is an - EXPERIMENTAL option. Returns: A Server object. @@ -2052,7 +2011,7 @@ def server(thread_pool, () if handlers is None else handlers, () if interceptors is None else interceptors, () if options is None else options, - maximum_concurrent_rpcs, compression, xds) + maximum_concurrent_rpcs, compression) @contextlib.contextmanager diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi index c1b998cc887..73d9fb4ea97 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi @@ -822,8 +822,7 @@ cdef class AioServer: init_grpc_aio() # NOTE(lidiz) Core objects won't be deallocated automatically. # If AioServer.shutdown is not called, those objects will leak. - # TODO(rbellevi): Support xDS in aio server. - self._server = Server(options, False) + self._server = Server(options) grpc_server_register_completion_queue( self._server.c_server, global_completion_queue(), diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi index 827f6f17ca3..ddaedb30bd4 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi @@ -76,13 +76,6 @@ cdef class CompositeChannelCredentials(ChannelCredentials): cdef grpc_channel_credentials *c(self) except * -cdef class XDSChannelCredentials(ChannelCredentials): - - cdef readonly ChannelCredentials _fallback_credentials - - cdef grpc_channel_credentials *c(self) except * - - cdef class ServerCertificateConfig: cdef grpc_ssl_server_certificate_config *c_cert_config diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index e7e59261b45..b1d0a8b2f4a 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -178,18 +178,6 @@ cdef class CompositeChannelCredentials(ChannelCredentials): return c_composition -cdef class XDSChannelCredentials(ChannelCredentials): - - def __cinit__(self, fallback_credentials): - self._fallback_credentials = fallback_credentials - - cdef grpc_channel_credentials *c(self) except *: - cdef grpc_channel_credentials *c_fallback_creds = self._fallback_credentials.c() - cdef grpc_channel_credentials *xds_creds = grpc_xds_credentials_create(c_fallback_creds) - grpc_channel_credentials_release(c_fallback_creds) - return xds_creds - - cdef class ServerCertificateConfig: def __cinit__(self): @@ -359,31 +347,11 @@ cdef class LocalChannelCredentials(ChannelCredentials): def channel_credentials_local(grpc_local_connect_type local_connect_type): return LocalChannelCredentials(local_connect_type) -cdef class InsecureChannelCredentials(ChannelCredentials): - - cdef grpc_channel_credentials *c(self) except *: - return grpc_insecure_credentials_create() - -def channel_credentials_insecure(): - return InsecureChannelCredentials() - def server_credentials_local(grpc_local_connect_type local_connect_type): cdef ServerCredentials credentials = ServerCredentials() credentials.c_credentials = grpc_local_server_credentials_create(local_connect_type) return credentials -def xds_server_credentials(ServerCredentials fallback_credentials): - cdef ServerCredentials credentials = ServerCredentials() - credentials.c_credentials = grpc_xds_server_credentials_create(fallback_credentials.c_credentials) - # NOTE: We do not need to call grpc_server_credentials_release on the - # fallback credentials here because this will be done by the __dealloc__ - # method of its Cython wrapper. - return credentials - -def insecure_server_credentials(): - cdef ServerCredentials credentials = ServerCredentials() - credentials.c_credentials = grpc_insecure_server_credentials_create() - return credentials cdef class ALTSChannelCredentials(ChannelCredentials): diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index b7d5e2e4c87..b873bb0676f 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -397,16 +397,6 @@ cdef extern from "grpc/grpc.h": void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved) nogil - - ctypedef struct grpc_server_config_fetcher: - pass - - void grpc_server_set_config_fetcher( - grpc_server* server, grpc_server_config_fetcher* config_fetcher) nogil - - grpc_server_config_fetcher* grpc_server_config_fetcher_xds_create() nogil - - int grpc_server_add_insecure_http2_port( grpc_server *server, const char *addr) nogil void grpc_server_start(grpc_server *server) nogil @@ -524,16 +514,6 @@ cdef extern from "grpc/grpc_security.h": void *reserved) nogil void grpc_channel_credentials_release(grpc_channel_credentials *creds) nogil - grpc_channel_credentials *grpc_xds_credentials_create( - grpc_channel_credentials *fallback_creds) nogil - - grpc_channel_credentials *grpc_insecure_credentials_create() nogil - - grpc_server_credentials *grpc_xds_server_credentials_create( - grpc_server_credentials *fallback_creds) nogil - - grpc_server_credentials *grpc_insecure_server_credentials_create() nogil - grpc_call_credentials *grpc_composite_call_credentials_create( grpc_call_credentials *creds1, grpc_call_credentials *creds2, void *reserved) nogil diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index ffd06ca4edc..48014b68804 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -15,7 +15,7 @@ cdef class Server: - def __cinit__(self, object arguments, bint xds): + def __cinit__(self, object arguments): fork_handlers_and_grpc_init() self.references = [] self.registered_completion_queues = [] @@ -25,8 +25,6 @@ cdef class Server: self.c_server = NULL cdef _ChannelArgs channel_args = _ChannelArgs(arguments) self.c_server = grpc_server_create(channel_args.c_args(), NULL) - if xds: - grpc_server_set_config_fetcher(self.c_server, grpc_server_config_fetcher_xds_create()) self.references.append(arguments) def request_call( diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 069ffa79822..48ff7439951 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -945,9 +945,9 @@ class _Server(grpc.Server): # pylint: disable=too-many-arguments def __init__(self, thread_pool, generic_handlers, interceptors, options, - maximum_concurrent_rpcs, compression, xds): + maximum_concurrent_rpcs, compression): completion_queue = cygrpc.CompletionQueue() - server = cygrpc.Server(_augment_options(options, compression), xds) + server = cygrpc.Server(_augment_options(options, compression)) server.register_completion_queue(completion_queue) self._state = _ServerState(completion_queue, server, generic_handlers, _interceptor.service_pipeline(interceptors), @@ -989,7 +989,7 @@ class _Server(grpc.Server): def create_server(thread_pool, generic_rpc_handlers, interceptors, options, - maximum_concurrent_rpcs, compression, xds): + maximum_concurrent_rpcs, compression): _validate_generic_rpc_handlers(generic_rpc_handlers) return _Server(thread_pool, generic_rpc_handlers, interceptors, options, - maximum_concurrent_rpcs, compression, xds) + maximum_concurrent_rpcs, compression) diff --git a/src/python/grpcio/grpc/_simple_stubs.py b/src/python/grpcio/grpc/_simple_stubs.py index 3dd44c705ed..f9ce5ec50f5 100644 --- a/src/python/grpcio/grpc/_simple_stubs.py +++ b/src/python/grpcio/grpc/_simple_stubs.py @@ -60,13 +60,20 @@ else: def _create_channel(target: str, options: Sequence[Tuple[str, str]], channel_credentials: Optional[grpc.ChannelCredentials], compression: Optional[grpc.Compression]) -> grpc.Channel: - _LOGGER.debug( - f"Creating secure channel with credentials '{channel_credentials}', " + - f"options '{options}' and compression '{compression}'") - return grpc.secure_channel(target, - credentials=channel_credentials, - options=options, - compression=compression) + if channel_credentials is grpc.experimental.insecure_channel_credentials(): + _LOGGER.debug(f"Creating insecure channel with options '{options}' " + + f"and compression '{compression}'") + return grpc.insecure_channel(target, + options=options, + compression=compression) + else: + _LOGGER.debug( + f"Creating secure channel with credentials '{channel_credentials}', " + + f"options '{options}' and compression '{compression}'") + return grpc.secure_channel(target, + credentials=channel_credentials, + options=options, + compression=compression) class ChannelCache: diff --git a/src/python/grpcio/grpc/experimental/__init__.py b/src/python/grpcio/grpc/experimental/__init__.py index c820bc9db3b..a4e2660fb4e 100644 --- a/src/python/grpcio/grpc/experimental/__init__.py +++ b/src/python/grpcio/grpc/experimental/__init__.py @@ -22,7 +22,6 @@ import sys import warnings import grpc -from grpc._cython import cygrpc as _cygrpc _EXPERIMENTAL_APIS_USED = set() @@ -42,16 +41,19 @@ class UsageError(Exception): """Raised by the gRPC library to indicate usage not allowed by the API.""" -# It's important that there be a single insecure credentials object so that its -# hash is deterministic and can be used for indexing in the simple stubs cache. +_insecure_channel_credentials_sentinel = object() _insecure_channel_credentials = grpc.ChannelCredentials( - _cygrpc.channel_credentials_insecure()) + _insecure_channel_credentials_sentinel) def insecure_channel_credentials(): """Creates a ChannelCredentials for use with an insecure channel. THIS IS AN EXPERIMENTAL API. + + This is not for use with secure_channel function. Intead, this should be + used with grpc.unary_unary, grpc.unary_stream, grpc.stream_unary, or + grpc.stream_stream. """ return _insecure_channel_credentials diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json index bd4139b4922..083b016748d 100644 --- a/src/python/grpcio_tests/tests/tests.json +++ b/src/python/grpcio_tests/tests/tests.json @@ -77,7 +77,6 @@ "unit._session_cache_test.SSLSessionCacheTest", "unit._signal_handling_test.SignalHandlingTest", "unit._version_test.VersionTest", - "unit._xds_credentials_test.XdsCredentialsTest", "unit.beta._beta_features_test.BetaFeaturesTest", "unit.beta._beta_features_test.ContextManagementAndLifecycleTest", "unit.beta._connectivity_channel_test.ConnectivityStatesTest", diff --git a/src/python/grpcio_tests/tests/unit/BUILD.bazel b/src/python/grpcio_tests/tests/unit/BUILD.bazel index d9338867f53..9969729ce94 100644 --- a/src/python/grpcio_tests/tests/unit/BUILD.bazel +++ b/src/python/grpcio_tests/tests/unit/BUILD.bazel @@ -40,7 +40,6 @@ GRPCIO_TESTS_UNIT = [ "_server_shutdown_test.py", "_server_wait_for_termination_test.py", "_session_cache_test.py", - "_xds_credentials_test.py", ] py_library( diff --git a/src/python/grpcio_tests/tests/unit/_cython/_cancel_many_calls_test.py b/src/python/grpcio_tests/tests/unit/_cython/_cancel_many_calls_test.py index c84dff614ab..b279f3d07c5 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/_cancel_many_calls_test.py +++ b/src/python/grpcio_tests/tests/unit/_cython/_cancel_many_calls_test.py @@ -144,10 +144,12 @@ class CancelManyCallsTest(unittest.TestCase): test_constants.THREAD_CONCURRENCY) server_completion_queue = cygrpc.CompletionQueue() - server = cygrpc.Server([( - b'grpc.so_reuseport', - 0, - )], False) + server = cygrpc.Server([ + ( + b'grpc.so_reuseport', + 0, + ), + ]) server.register_completion_queue(server_completion_queue) port = server.add_http2_port(b'[::]:0') server.start() diff --git a/src/python/grpcio_tests/tests/unit/_cython/_common.py b/src/python/grpcio_tests/tests/unit/_cython/_common.py index 42ec655feee..d8210f36f80 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/_common.py +++ b/src/python/grpcio_tests/tests/unit/_cython/_common.py @@ -96,7 +96,7 @@ class RpcTest(object): def setUp(self): self.server_completion_queue = cygrpc.CompletionQueue() - self.server = cygrpc.Server([(b'grpc.so_reuseport', 0)], False) + self.server = cygrpc.Server([(b'grpc.so_reuseport', 0)]) self.server.register_completion_queue(self.server_completion_queue) port = self.server.add_http2_port(b'[::]:0') self.server.start() diff --git a/src/python/grpcio_tests/tests/unit/_cython/_read_some_but_not_all_responses_test.py b/src/python/grpcio_tests/tests/unit/_cython/_read_some_but_not_all_responses_test.py index 4aad924427b..8a903bfaf91 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/_read_some_but_not_all_responses_test.py +++ b/src/python/grpcio_tests/tests/unit/_cython/_read_some_but_not_all_responses_test.py @@ -115,7 +115,7 @@ class ReadSomeButNotAllResponsesTest(unittest.TestCase): server = cygrpc.Server([( b'grpc.so_reuseport', 0, - )], False) + )]) server.register_completion_queue(server_completion_queue) port = server.add_http2_port(b'[::]:0') server.start() diff --git a/src/python/grpcio_tests/tests/unit/_cython/_server_test.py b/src/python/grpcio_tests/tests/unit/_cython/_server_test.py index 60b068243c0..bbd25457b3e 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/_server_test.py +++ b/src/python/grpcio_tests/tests/unit/_cython/_server_test.py @@ -25,7 +25,7 @@ class Test(unittest.TestCase): def test_lonely_server(self): server_call_completion_queue = cygrpc.CompletionQueue() server_shutdown_completion_queue = cygrpc.CompletionQueue() - server = cygrpc.Server(None, False) + server = cygrpc.Server(None) server.register_completion_queue(server_call_completion_queue) server.register_completion_queue(server_shutdown_completion_queue) port = server.add_http2_port(b'[::]:0') diff --git a/src/python/grpcio_tests/tests/unit/_cython/cygrpc_test.py b/src/python/grpcio_tests/tests/unit/_cython/cygrpc_test.py index 30cd5078ffa..1182f83a425 100644 --- a/src/python/grpcio_tests/tests/unit/_cython/cygrpc_test.py +++ b/src/python/grpcio_tests/tests/unit/_cython/cygrpc_test.py @@ -42,10 +42,12 @@ class TypeSmokeTest(unittest.TestCase): del completion_queue def testServerUpDown(self): - server = cygrpc.Server(set([( - b'grpc.so_reuseport', - 0, - )]), False) + server = cygrpc.Server(set([ + ( + b'grpc.so_reuseport', + 0, + ), + ])) del server def testChannelUpDown(self): @@ -57,10 +59,12 @@ class TypeSmokeTest(unittest.TestCase): b'test plugin name!') def testServerStartNoExplicitShutdown(self): - server = cygrpc.Server([( - b'grpc.so_reuseport', - 0, - )], False) + server = cygrpc.Server([ + ( + b'grpc.so_reuseport', + 0, + ), + ]) completion_queue = cygrpc.CompletionQueue() server.register_completion_queue(completion_queue) port = server.add_http2_port(b'[::]:0') @@ -75,7 +79,7 @@ class TypeSmokeTest(unittest.TestCase): b'grpc.so_reuseport', 0, ), - ], False) + ]) server.add_http2_port(b'[::]:0') server.register_completion_queue(completion_queue) server.start() @@ -93,10 +97,12 @@ class ServerClientMixin(object): def setUpMixin(self, server_credentials, client_credentials, host_override): self.server_completion_queue = cygrpc.CompletionQueue() - self.server = cygrpc.Server([( - b'grpc.so_reuseport', - 0, - )], False) + self.server = cygrpc.Server([ + ( + b'grpc.so_reuseport', + 0, + ), + ]) self.server.register_completion_queue(self.server_completion_queue) if server_credentials: self.port = self.server.add_http2_port(b'[::]:0', diff --git a/src/python/grpcio_tests/tests/unit/_xds_credentials_test.py b/src/python/grpcio_tests/tests/unit/_xds_credentials_test.py deleted file mode 100644 index 91d30c68ad5..00000000000 --- a/src/python/grpcio_tests/tests/unit/_xds_credentials_test.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2021 The 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. -"""Tests xDS server and channel credentials.""" - -import unittest - -import logging -from concurrent import futures -import contextlib - -import grpc -import grpc.experimental -from tests.unit import test_common -from tests.unit import resources - - -class _GenericHandler(grpc.GenericRpcHandler): - - def service(self, handler_call_details): - return grpc.unary_unary_rpc_method_handler( - lambda request, unused_context: request) - - -@contextlib.contextmanager -def xds_channel_server_without_xds(server_fallback_creds): - server = grpc.server(futures.ThreadPoolExecutor()) - server.add_generic_rpc_handlers((_GenericHandler(),)) - server_server_fallback_creds = grpc.ssl_server_credentials( - ((resources.private_key(), resources.certificate_chain()),)) - server_creds = grpc.xds_server_credentials(server_fallback_creds) - port = server.add_secure_port("localhost:0", server_creds) - server.start() - try: - yield "localhost:{}".format(port) - finally: - server.stop(None) - - -class XdsCredentialsTest(unittest.TestCase): - - def test_xds_creds_fallback_ssl(self): - # Since there is no xDS server, the fallback credentials will be used. - # In this case, SSL credentials. - server_fallback_creds = grpc.ssl_server_credentials( - ((resources.private_key(), resources.certificate_chain()),)) - with xds_channel_server_without_xds( - server_fallback_creds) as server_address: - override_options = (("grpc.ssl_target_name_override", - "foo.test.google.fr"),) - channel_fallback_creds = grpc.ssl_channel_credentials( - root_certificates=resources.test_root_certificates(), - private_key=resources.private_key(), - certificate_chain=resources.certificate_chain()) - channel_creds = grpc.xds_channel_credentials(channel_fallback_creds) - with grpc.secure_channel(server_address, - channel_creds, - options=override_options) as channel: - request = b"abc" - response = channel.unary_unary("/test/method")( - request, wait_for_ready=True) - self.assertEqual(response, request) - - def test_xds_creds_fallback_insecure(self): - # Since there is no xDS server, the fallback credentials will be used. - # In this case, insecure. - server_fallback_creds = grpc.insecure_server_credentials() - with xds_channel_server_without_xds( - server_fallback_creds) as server_address: - channel_fallback_creds = grpc.experimental.insecure_channel_credentials( - ) - channel_creds = grpc.xds_channel_credentials(channel_fallback_creds) - with grpc.secure_channel(server_address, channel_creds) as channel: - request = b"abc" - response = channel.unary_unary("/test/method")( - request, wait_for_ready=True) - self.assertEqual(response, request) - - def test_start_xds_server(self): - server = grpc.server(futures.ThreadPoolExecutor(), xds=True) - server.add_generic_rpc_handlers((_GenericHandler(),)) - server_fallback_creds = grpc.insecure_server_credentials() - server_creds = grpc.xds_server_credentials(server_fallback_creds) - port = server.add_secure_port("localhost:0", server_creds) - server.start() - server.stop(None) - # No exceptions thrown. A more comprehensive suite of tests will be - # provided by the interop tests. - - -if __name__ == "__main__": - logging.basicConfig() - unittest.main()